Is it possible, while setting up a constructor, to have it's parameters passed right into one of it's methods? Here's what i mean:
function jedi(name,text){
this.name = name;
this.quote = function quote(name,text){
return name + " said " + text;
};
}
var obiwan = new jedi('Obi-Wan','Fear leads to the darkside');
console.log(obiwan.quote()); //renders as undefined said undefined
//this works fine though
console.log(obiwan.quote('Obi-Wan','Fear leads to the darkside'));
Is it possible to pass the 'name' and 'text' parameters right from 'var obiwan = new jedi()' to 'obiwan.quote()'? I hope my question makes sense. Thanks in advance to anyone that can help me out!
this: developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/…