Index
Objects


Discussion Here
let prn = console.log;

class Foo {
	
	static hey() {
		prn("Hello from static hey()");
		(new this()).hey();
	}
	
	hey() {
		prn("Hello from instance hey()");
	}
	
	static wow() {
		prn("Hello from static wow()");
	}
	
	wow() {
		prn("Hello from instance wow()");
		this.constructor.wow();
	}
	
}

prn("--");
Foo.hey();
prn("--");
(new Foo()).hey();
prn("--");
(new Foo()).wow();
prn("--");
Foo.wow();



Syntax


The operator precedence listing is here...

One surprising snippet is shown below (just for fun) -- parens around "new Foo()" are optional for (new Foo()).sayHello(). It's still a good idea to use parens here for clarity.












Navigation