4
Reply

Here i am getting output as undefined, please tell me why

Minhaj Hussain

Minhaj Hussain

Jan 21 2018 2:05 AM
137
<script type="text/javascript">
function Employee() {
this.Name="Minhaj"
var getName = function() {
return this.Name;
}
this.PrivGetName=function () {
return getName();
}
Employee.prototype.Publicget=function () {
return this.PrivGetName();
}
}
var obj=new Employee();
alert(obj.Publicget());
//OUTPUT IS UNDEFINED
</script>

Answers (4)