lab13: init

This commit is contained in:
2026-04-08 10:58:56 -07:00
parent 2ef46d20c0
commit 4fd0fec404
3 changed files with 44 additions and 0 deletions

20
lab13/salary.js Normal file
View File

@@ -0,0 +1,20 @@
function Employee(fname, lname, salary) {
this.fname = fname;
this.lname = lname;
this.salary = salary;
}
var emps = [new Employee("Alice", "Alleyson", 95000),
new Employee("Robert", "Tables", "80000"),
new Employee("Charles", "Chaplin", 42350)];
function totalSalary(empList) {
var ttl = 0;
for (i in empList) {
ttl += empList[i].salary;
}
return ttl;
}
console.log(totalSalary(emps));