Home / Expert Answers / Computer Science / write-a-function-printpayroll-that-takes-an-array-of-employees-each-of-which-is-defined-as-a-simple-pa882

(Solved): Write a function printPayroll that takes an array of employees, each of which is defined as a simple ...



Write a function printPayroll that takes an array of employees, each of which is defined as a simple JavaScript object, and prints on the console a list for each employee showing the name, title, and salary. For example, if SCROOGE_AND_MARLEY has been initialized as a two-element array containing the entries for Ebenezer Scrooge and Bob Cratchit shown in the chapter, your function should be able to generate the following sample run: Give me a code like this example, please?????? let clerk = { name: "Bob Cratchit", title: "clerk", salary: 25 }; let boss = { name: "Ebenezer Scrooge", title: "boss", salary: clerk.salary * 10 }; let employees = [clerk, boss]; // tip to get started with Chapter 9 exercise function getClerk() { let str = "Name: " + clerk.name + "<br />" + "Title: " + clerk.title + "<br />" + "Salary: $" + clerk.salary + "<br />"; document.getElementById("clerk").innerHTML = str; } function getBoss() { let str = "Name: " + boss.name + "<br />" + "Title: " + boss.title + "<br />" + "Salary: $" + boss.salary + "<br />"; document.getElementById("boss").innerHTML = str; }



We have an Answer from Expert

View Expert Answer

Expert Answer



Answer the following Question:

printpayroll
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe