Home

Learn Class.

Javascript class.

function Person( name, dateEmployed ) { this.name = name; this.dateEmployed = dateEmployed; } Person.prototype.print = function( char ) { console.log( this.name + ", employeed: " + this.dateEmployed ); } let p = new Person( 'Charles', '2020-01-01' ); p.print();
class Person { constructor( name, dateEmployed ) { this.name = name; this.dateEmployed = dateEmployed; } print() { console.log( this.name + ", employeed: " + this.dateEmployed ); } } let p = new Person( 'Brenda', '2020-02-01' ); p.print();

Immediately-invoked Function Expressions.

;(function() { // <-- semicolon at start of library makes concatenating files easier function internalVar() {} var internalVar; })()