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?
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
More JavaScript MCQ Questions