Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Love at First Language

Love at First Language

How I fell in love with programming - pretty late in life
Held at MediterranéaJS, Barcelona, June 2015
http://mediterraneajs.eu/

viddity

June 23, 2015
Tweet

Other Decks in Programming

Transcript

  1. Love at first language why JavaScript is an excellent choice

    to begin with programming twitter @viddity
  2. * encouraged to take my obsession serious * overcome the

    fear to be too late, not smart enough * to go for it professionally
  3. ?

  4. VARIABLES: are in scope from the point declared to end

    of function declared in FUNCTIONS: are in scope throughout their ecompassing function
  5. Test Suite function assert(value, desc) { var li = document.createElement('li');

    li.className = value ? 'pass' : 'fail'; li.appendChild(document.createTextNode(desc)); document.getElementById('results').appendChild(li); } .pass {color: green;} .fail {color: red;}
  6. Test Suite function assert(value, desc) { var li = document.createElement('li');

    li.className = value ? 'pass' : 'fail'; li.appendChild(document.createTextNode(desc)); document.getElementById('results').appendChild(li); } .pass {color: green;} .fail {color: red;} assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope");
  7. code example function outer() { var a = "nerveous?"; var

    b = "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  8. assert(typeof outer === "function", "outer in scope"); assert(typeof inner ===

    "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); function outer() { var a = "nerveous?"; var b = "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  9. assert(typeof outer === "function", "outer in scope"); assert(typeof inner ===

    "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); function outer() { var a = "nerveous?"; var b = "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  10. function outer() { assert(typeof outer === "function", "outer in scope");

    assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); var a = "nerveous?"; var b = "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  11. function outer() { assert(typeof outer === "function", "outer in scope");

    assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); var a = "nerveous?"; var b = "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  12. function outer() { var a = "nerveous?"; var b =

    "terribly!"; assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  13. function outer() { var a = "nerveous?"; var b =

    "terribly!"; assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  14. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  15. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } outer();
  16. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); var c = a + " " + b; console.log(c); } } inner(); } outer();
  17. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); var c = a + " " + b; console.log(c); } } inner(); } outer();
  18. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); } } inner(); } outer();
  19. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); } } inner(); } outer();
  20. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); } inner(); } outer();
  21. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); } inner(); } outer();
  22. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); inner(); } outer();
  23. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); inner(); } outer();
  24. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); outer();
  25. function outer() { var a = "nerveous?"; var b =

    "terribly!"; function inner() { if (a === "nerveous?") { var c = a + " " + b; console.log(c); } } inner(); } assert(typeof outer === "function", "outer in scope"); assert(typeof inner === "function", "inner in scope"); assert(typeof a === "string", "a in scope"); assert(typeof b === "string", "b in scope"); assert(typeof c === "string", "c in scope"); outer();
  26. * SCOPE "bubbles" in JS defined by functions * SCOPE

    "look-up" direction: inside to outside * the "look-up" stops at first match found
  27. * a function's SCOPE can be used to hide variables

    from other SCOPES * other blocks don't end SCOPE - usually ...
  28. Some of the online learning resources that helped me: 4

    https://www.codeschool.com/ 4 http://www.codecademy.com/ 4 http://leveluptuts.com/tutorials/javascript- tutorials
  29. Books I enjoye(d): 4 Secrets of a JavaScript Ninja 4

    A Smarter Way to Learn JavaScript 4 You Don't Know JS Series: https://github.com/getify/ You-Dont-Know-JS