I am newbie to Javascript and the syntax just bugs me. The output is giving me undefined as an alert after every function declaration output.
let func=[
{
sayHi:function(){
alert('hello');
},
saybi:function(){
alert('Bye');
}
},
{
sayName:function(name){
alert('Hii !! ', +name);
},
askName:function(){
alert("What's your name ??");
}
}
];
alert(func[0].sayHi());
let name=prompt("What's your name ?","");
if(name!="")
{
alert(func[1].sayName(name));
}
else{
alert(func[1].askName());
}