MCQs > IT & Programming > JavaScript > The following are sample code on how to loop through JavaScript object literals with objects as members: Var validation_messages = { 'key_1' : { 'your_msg' : 'hello world' } , 'Key_2' : {'your_name' : 'billy', 'your_msg' : 'foo equals bar' } } Which are invalid native JavaScript codes?

JavaScript MCQs

The following are sample code on how to loop through JavaScript object literals with objects as members:

Var validation_messages = {

“key_1” : {

“your_msg” : “hello world”

} ,

“Key_2” : {

“your_name” : “billy”,

“your_msg” : “foo equals bar”

}

}

Which of the following are invalid native JavaScript codes?

Answer

Correct Answer: For (var key in validation_messages) { Var obj = validation_messages[key]; For (var prop in obj) { Alert(prop + “ = “ + obj[prop]); } }

Explanation:

Note: This Question is unanswered, help us to find answer for this one

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it

search

JavaScript Skill Assessment

Overall Skill Level-Poor

Your Skill Level: Poor

Retake Quizzes to improve it