Exercise on Objects in ES6

Now, we'll create a "Basket" object using the concepts of Objects.

Exercise 1:

Suppose an array of firstName, email, basketValue triples are given. Create ONE JavaScript expression that puts a default value of '-' and 0 to the firstName or basketValue fields respectively, whenever the firstName or the basketValue keys are missing. Remember to name your new object, newBaskets or your code won’t run.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.