Minhaj Hussain

Minhaj Hussain

  • NA
  • 86
  • 5.7k

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

Jan 21 2018 2:05 AM
<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)