I have a printName function as below:
function printName(name) {
console.log('Name is': , name);
}
Now i want to execute printName.callAfter(3000, 'foo')
, which should log
'Name is: foo' after 3 seconds.
I tried writing :
myName.prototype.callAfter = function(time, name) {
setTimeout(function() {
printName(name)
}, time);
}
But its only giving me myName.prototype.callAfter as a defined function but myName.callAfter is undefined.
Please help. Thanks in advance