I have created var template but when I console.log in chrome console nothing shows up. I am a little confused because if I remove the console.log('template created'); and move it above the var template = function() it renders in the console
var Template = function(){
// -------------------------------------------------------------------------
this.__construct = function(){
console.log('template created');
};
// -------------------------------------------------------------------------
//works in console
console.log('template created');
var Template = function(){
// -------------------------------------------------------------------------
this.__construct = function(){
};
//-------------------------------------------------------------------------
};
__constructhas no special meaning in JavaScript. Therefore, you have to execute the function for it work.Template.__construct()it should log to the console. I think you are expecting it to automatically work when you construct the Template object, which is not the case. JavaScript has no notion of__constructas I've stated that's a PHP thing I believe. Also, the//characters indicate a comment so they are not necessary. Can you place the link to the tutorial?