Scope Visualization(By lizhihao132)
ECMA version:
es14_2023
es6_2015
es5
Source type:
script
module
Click track:
no
ast
scope
Parsed By:
eslint-scope
v
,
acorn
v
class Bork { //Property initializer syntax instanceProperty = "bork"; boundFunction = () => { return this.instanceProperty; }; //Static class properties static staticProperty = "babelIsCool"; static staticFunction = function() { return Bork.staticProperty; }; talk(xyz){ console.info('a') } static say(xyz){ console.info('a') } } let myBork = new Bork(); //Property initializers are not on the prototype. console.log(myBork.__proto__.boundFunction); // > undefined //Bound functions are bound to the class instance. console.log(myBork.boundFunction.call(undefined)); // > "bork" //Static function exists on the class. console.log(Bork.staticFunction()); // > "babelIsCool" //https://babeljs.io/docs/babel-plugin-transform-class-properties