MCQs > IT & Programming > JavaScript > The following are sample codes on how to merge properties of two JavaScript objects dynamically: var objl = { food: var obj2 = { animal: 'dog' }

JavaScript MCQs

The following are sample codes on how to merge properties of two JavaScript objects dynamically:

var objl = { food: var obj2 = { animal: "dog"}

Answer

Correct Answer:

Object.extend = function(destination., source) {

for (var property in source)

destination[property] = source[property];

return destination;

}

objl.extend(obj2)


Explanation:

Note: This question has more than 1 correct answers

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