I am trying to create a function to automatically create object and then alert its properties. However, there seems to be some problem as I cannot get the alerts on click of button. Can someone help?
<html>
<head>
<script>
var player = function (x, y, z, i) {
return :{
firstName: x,
lastName: y,
quote: z,
salary: function (i) {
return (i + 3000)
}
};
}
var Saurav = player('Saurav', 'Ganguli', 'Bengali Babu', 1000);
function alertify() {
alert(Saurav.firstName);
alert(Saurav.lastName);
alert(Saurav.quote);
alert(Saurav.salary(2000));
}
</script>
</head>
<body>
<button onclick="alertify()">Click Me!</button>
</body>
</html>
return:{firstName, the:should not be there afterreturn