const/let/var scope

node v6.17.1
endpointsharetweet
{ var x = 1 // will escape the scope let y = 2 // bound to lexical scope const z = 3 // bound to lexical scope, constant } console.log(x) // 1 try { console.log(y) } catch (error) { console.log(error) } try { console.log(z) } catch (error) { console.log(error) }
Loading…

no comments

    sign in to comment