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:

in javascript write code in this function to print out the contents

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!