How do I properly call the functions inside pretest?
I get this error: Uncaught TypeError: b.testmenow is not a function
var pretest = function () {
var MAX_NUM = 250.0;
var prebase = function (NEW_NUM) {
this.NEW_NUM = NEW_NUM ? NEW_NUM : true;
};
prebase.prototype.testmenow = function () {
return this.NEW_NUM;
};
return prebase;
};
var b = new pretest(111);
console.log(b.testmenow());
return new prebase()but it's super strange how you're doing this. Try searching to learn more on prototypes and constructors.pretestis a function that returns a constructor, it's not a constructor itself. Not sure why you are doing this, but with minimal changes to your code:var b = new (pretest())(111);.prebasedirectly — what ispretest's contribution?