Im trying to become more object orientated in my approach to doing things and ive run into an error where the console says a function is undefined. I cant see how because i have other functions that run that have the same makeup.
i set up my object like this in my app.js:
var vid = new videoAPI(whichOs.type());
Then i set up my constructor in my lib.js:
function videoAPI(osParam)
{
this.os = osParam;
}
And create my methods the one I have issues with is this one in my lib.js:
videoAPI.prototype.print = function()
{
return this.os;
}
I then call in my app.js
console.log(print());
I have two other functions that use this setup but i pass variables in. Can anyone tell me what im doing wrong?
**edit. The line it fails on is is print(); I didnt mention i have this in a node.js project linking two js files together. this is the error:
ReferenceError: print is not defined
at Object.<anonymous> (C:\Users\denis\Desktop\videoServer\app.js:36:13)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
var vid = new videoAPI('A');works with no errors.console.log(vid.print());