class varC {
// Add a constructor function
constructor(argument1, argument2) {
this.var1 = argument1;
this.var2 = argument2;
}
// Add a function which will add in prototype
varF1 () {statement}
// Add a Static function which doesn't use any arguments of Class
static varF2 () {statement}
}
variable = new varC(parameter1, parameter2) => Create a Object using Class templatevariable.varF1() => Call a function inside the classvarC.varF2() => Call a static function inside the class class varC1 extends varC {
constructor(argument1, argument2, argument3) {
super(argument1, argument2)
this.var3 = argument3;
}
}
function var (parameter1, parameter2) {
this.var1 = parameter1;
this.var2 = parameter2;
}
function var4 (parameter1, parameter2, parameter3) {
var.call(this, argument1, argument2);
this.var3 = argument3;
}
var.prototype.var1 = function () {} => Create a prototype of a constructorvar4.prototype = Object.create(var.prototype) => Manually add prototype of var in var4var4.prototype.constructor = var => Manually add constructorvar1 = new var(parameter1, parameter2) => Creating a object using constructor functionvar.prototype.var2 = function() {} => Add prototype to the constructor functionconst var = Object.create(variable) => Create object using another objectconst var = Object.create(variable, {key: {value: "value"}}) => Create object using another objectlet variable = new Object() => Create a object let variable = {
var1: value
varF() {statemtnt}
var3: function() {statement}
}
delete variable[key] => To deletevariable[var1] => To access value of variable1, If var has space then accessible by only this methodvariable.var3() => To access function variable3Object.keys(variable) => Returns array created from ObjectObject.keys(variable).length => Returns length of ArrayObject.keys(variable)[N] => Access keysvariable[Object.keys(variable)[N]] => Access values of keysfor(let variable1 in variable) {statement}variable.var1 => To access value of variable1