The following is my javascript code for accessing a private method. But it is not working. I receive a TypeError: string is not a function
message. Can anyone please help me?
Here is my code:
function Boy(firstName,lastName) {
this.fisrtName = firstName;
this.lastName = lastName ;
var ladyLove = "Angelina";
var returnLove = function() {
return ladyLove;
};
this.sayLoud = function(){
return returnLove();
};
}
var achilles = new Boy("Bradley","Pitt");
var sayNow = achilles.sayLoud();
console.log(sayNow());