Questions tagged as 'hoisting'

1
answer

What is the use of hoisting in JavaScript?

Before ES6, all variables in a function were created independently of JS scope. That is: if(false) { var mensagem = "Olá!"; // declaração + atribuição } console.log(mensagem); => undefined Return is not something like a reference error...
asked by 26.02.2018 / 01:14
1
answer

Explanation Hoisting JavaScript [duplicate]

In JavaScript, every variable that is declared with the var keyword is "Hoisting" to the top of the execution context, right? function testandoMsg (){ let b = 'B'; console.log(a); console.log(b); var a = 'A'; } testandoMsg();...
asked by 28.06.2018 / 14:24