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

JavaScript: Past, Present, and Future - NDC Porto 2020

JavaScript: Past, Present, and Future - NDC Porto 2020

Ah, JavaScript! Like it or not, it's a "tragically important" language that is "eating the world." Hate it? Love it? Avoid it? Embrace it?

This talk will be a parade of face-palm JavaScript fails, stupid JavaScript tricks, and bad jokes sure to get an eye-roll from everyone! Along the way, we may even learn a few mistakes to avoid and tips to make our own JavaScript less terrible!

David Neal

April 24, 2020
Tweet

More Decks by David Neal

Other Decks in Programming

Transcript

  1. > const lol = a + b + c –

    f * ( n + o ); NaN
  2. ( a + b ) + c = a +

    ( b + c ) // mathematically true > 0.1 + 0.2 === 0.3 false > ( a + b ) + c == a + ( b + c ) ??
  3. > typeof undefined // undefined > typeof true // boolean

    > typeof "hello" // string > typeof 1 // number > typeof {lol:true} // object > typeof [1,2,3] // object > typeof null // object
  4. > null == 0 // false > null > 0

    // false > null < 0 // false > null >= 0 // true > null <= 0 // true > Number( null ) // 0
  5. // undefined function troll() { return { haha: "ha!" };

    } troll(); // automatic semi-colon
  6. const arr = []; arr[1] = 1; arr[3] = 2;

    arr[10] = 3; arr.length // 11 arr[-1] = 4; arr.s = 5; arr.length // 11
  7. const user1 = { firstName: "David", lastName: "Neal", address: {

    street: "123 Main Street", city: "Nashville", state: "Tennessee" } };
  8. const user1 = { firstName: "David", lastName: "Neal", address: {

    street: "123 Main Street", city: "Nashville", state: "Tennessee" } }; const city = user1?.address?.zipCode;
  9. let config; if (production) { config = await import("./config.production.js"); }

    reportBtn.addEventListener("click", async () => { const reporter = await import("./reporter.js); reporter.generateReport(); });