class A {
f1() {
f2();
}
f2() {}
}
var a = new A();
console.log(a.f1());
returns f2 is not defined.
Whereas:
{
function f1() {
return f2();
}
function f2() {
return 'f2';
}
console.log(f1());
}
prints 'f2'
I'm just wondering why functions within classes are not hoisted?