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

Learn JavaScript Well

高見龍
October 25, 2020

Learn JavaScript Well

MOPCON 2020 分享主題「打造資深實力 - 你該學好的 JavaScript」

高見龍

October 25, 2020
Tweet

More Decks by 高見龍

Other Decks in Programming

Transcript

  1. ޒഒላӃ .01$0/ var a = 1; var a; console.log(a); //

    會印出什什麼? ༗झޠ๏ 1
  2. ޒഒላӃ .01$0/ if (false) { var a = 1; }

    console.log(a); // 會印出什什麼? ༗झޠ๏ undefined
  3. ޒഒላӃ .01$0/ sayHello(); function sayHello() { console.log('hello'); } ༗झޠ๏ ݐཱظ

    1A 1B sayHello(); function sayHello() { console.log('hello'); } 2
  4. ޒഒላӃ .01$0/ { hello: for (var i = 0; i

    < 10; i++ ) { if (i % 2 === 0) { continue hello; } console.log(i); } } ༗झޠ๏ label label Block
  5. ޒഒላӃ .01$0/ +'' // 0 +[] // 0 +{} //

    NaN +-1 // -1 +true // 1 +false // 0 +undefined // NaN +null // 0 ༗झޠ๏
  6. ޒഒላӃ .01$0/ [] + [] // ? [] + {}

    // ? {} + [] // ? ༗झޠ๏
  7. ޒഒላӃ .01$0/ [] + [] // '' [] + {}

    // '[object Object]' {} + [] // 0 ༗झޠ๏
  8. ޒഒላӃ .01$0/ ( function( global, factory ) { "use strict";

    // 略略 } )( typeof window !== "undefined" ? window : this, function( window, noGlobal ) { // 略略 IIFE ৽खᢛ࿝അ