This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Post(){}; | |
Post.prototype = {test : function(){console.log("hello there")}}; | |
p = new Post(); | |
p.test(); | |
/* but I prefer to do two things differently: define my member functions in the 'class' function, and have objects inherit from objects: */ | |
function Post() { | |
this.test = function(){ console.log("hello there") } | |
} |