I've got an object called employee with its getters and setters will them be well defined and implement ?
How can I access the values of the object Person on my function List of Javascript so I can show it in my dynamic table?
var operations = {
init: function() {
console.log("init");
operations.setupButton();
},
setupButton: function() {
$("#btnList").on("click", operations.list);
},
list: function() {
var table = $("#tblEmployee");
var strHtml = "";
var emp = new employee();
// load my jsp table
strHtml += '<tr>';
strHtml += '<td>' + emp.getName + '</td>';
strHtml += '<td>' + emp.getAge + '</td>';
strHtml += '<td>' + emp.getSalary + '</td>';
strHtml += '<tr>';
tabla.append(strHtml);
}
};
var employee = {
name: 'Jean',
age: 22,
salary: 8000000,
getName() {
return this.name;
},
getAge() {
return this.age;
},
getSalary() {
return this.salary;
}
};
$(document).ready(operations.init);