Search code examples
javascripthoisting

Which version of ECMA specification introduced hoisting?


Does anyone know when the specifications for hoisting was introduced? And whether internet explorer version 6 supported it?

I didn't realize hoisting existed because these days, all my JavaScript code is transpiled.

I vaguely remember feeling proud on my first job as a web developer when I explained to my boss that his JavaScript program was crashing in IE6 or IE7 because he was invoking a function that was declared much later. I wonder if I have gone crazy and remembered things wrong?


Solution

  • I believe that JavaScript has implemented hoisting from the beginning. According to the MDN article on hoisting:

    Hoisting is a term you will not find used in any normative specification prose prior to ECMAScript® 2015 Language Specification.

    I read this to say that ECMA 2015 is the first time the term was used in the language spec but that the concept existed prior to that.