JavaScript Edu Resources. Angular Courses. React Tutorials. Join us!

Forward references in Angular 2

  • But on the other hand, using regular ES5 constructor functions that would be totally valid because function declarations get hoisted to the top by the JavaScript interpreter behind the scenes.
  • And then, aren’t ES2015 classes just sugar on top of regular ES5 functions after all?
  • But why doesn’t the JavaScript interpreter do that for us in the first place as it does for regular ES5 constructor functions?
  • Now think about what would actually happen if the JavaScript interpreter hoisted just like a regular ES5 constructor function?
  • Ok, now that we understood why classes aren’t hoisted what does that mean for our earlier Angular example where we had to move the to the very top?

Forward references in Angular by thoughtram

Comments are closed, but trackbacks and pingbacks are open.