DEV Community

Discussion on: Can somebody help me with React?

Collapse
 
merichard123 profile image
Richard • Edited

Most variables in JavaScript are hoisted which means the variable assignment and declaration are moved to the top of the code block so the const test='THIS IS FOR A TEST' Is moved to the top of the code block and the reference error is avoided

developer.mozilla.org/en-US/docs/G...

Collapse
 
giyeonkwon profile image
Giyeon Kwon

It says “Declarations using let and const are also not hoisted.“ ☹️

Collapse
 
merichard123 profile image
Richard

Ah ok. Didn't know es6 declarations aren't hoisted