var VS let VS const

2019-01-10  本文已影响3人  mihope

var:

  function scoped

  undefined when accessing a variable before it's declared

let:

  block scoped

  ReferenceError when accessing a variable before it's declared

const:

  block scoped

  ReferenceError when accessing a variable before it's declared

  can't be reassigned

上一篇 下一篇

猜你喜欢

热点阅读