Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what does the text before an object stand for in js

function Foo(who) {
	this.me = who;
}
Foo.prototype.identify = function () { 
	return "I am " + this.me; 
}

function Bar(who) { 
	Foo.call(this, who); 
}

Bar.prototype = Object.create(Foo.prototype); // __proto__: Foo.prototype

/*
	This will print only "Foo" because the object doesn't have any properties
    apart from __proto__. "Foo" is the name of the function, of which
    part is the prototype.
*/
console.log(Bar.prototype);
 
PREVIOUS NEXT
Tagged: #text #object #stand #js
ADD COMMENT
Topic
Name
5+8 =