https://code.sololearn.com/WRM3cmHYuoC5/?ref=app Hi everybody, In my code I used setInterval and within the function fusionate , but I declared fusionate function only After calling setInterval ( I Saw this order in the lesson). is Javascript Reading code from top to bottom or what's the reason that it works I want to understand thx.
11/24/2019 4:01:03 PM
Roronoa2 Answers
New Answerbecause of hoisting in pre-ES6 syntax. it is like var fusionate; // declare first code snippets such as setInterval fusionate = function() {...} // initiations this can cause bugs which are hard to debug, so in ES6 we have const keyword which cannot be hoisted https://code.sololearn.com/W7Qp4YH4XHjJ/?ref=app https://code.sololearn.com/WldMKAVDQWPQ/?ref=app
Sololearn Inc.
535 Mission Street, Suite 1591Send us a message