Question: in javascript write code in this function to print out the contents of the object which is passed in as a parameter. Use a loop
in javascript
write code in this function to print out the contents of the object which is passed in as a parameter. Use a loop to complete the task (rather than casting the object to a string).
* @param {object} objInventor object containing data about a person who is an inventor of a programming language.
* @return {string} String representing an Object
function displayObject(objInventor) {
//return processed array
return strObject;
}
should pass this test:

QUnit.test('Test display object function', function( assert ) { let inventorJS = { firstName: "Brendan", lastName: "Eich", dob: 1961, invented: "Javascript" }; let inventorPython { firstName: "Guido", lastName: "van Rossum", dob: 1956, invented: "Python" }; let strInventor1 = "Brendan Eich 1961 Javascript"; let strInventor2 = "Guido van Rossum 1956 Python"; assert.equal(displayObject(inventorjs), strInventori, "displayObject function test1 worked"); assert.equal(displayObject(inventorPython), strInventor2, "displayObject function test2 worked"); })
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
