Pages

Thursday, June 16, 2016

Coding challenge using an Underscore function

Combine 10 objects into one new object.  This new object should share no reference with any other object, in other words, adding a new property to this new object later on, will not also add that property to any other object.


Here's ten objects below to save you testing time:



var obj1 = {
name: "Joanna"
}

var obj2 = {
activities : "shopping"
}

var obj3 = {
age : 30
}

var obj4 = {
"hair color" : "brown"
}

var obj5 = {
"name real" : false
}

var obj6 = {
job : saleswoman
}

var obj7 = {
car : "Prius"
}

var obj8 = {
"car color" : "Purple"
}

var obj9 = {
height : "5 feet 11 inches"
}

var obj10 = {
weight : 180
}


This is very easily accomplished with extend.

No comments:

Post a Comment