Question: Please use modern JavaScript es6 syntax using let and const . Do not use html . Thank you Create a function named makeAnimals , the
Please use modern JavaScript es6 syntax using let and const . Do not use html .
Thank you
Create a function named makeAnimals, the function should create an object.
makeAnimals should accept a nested array of objects which contains a property and what that property should be assigned to.
makeAnimals should make a nested object with the key as the index from the array and the value from the object made from the property and assignment
You can Also use property and assign as needed to create the expected output object
For example :
const arr =
[
[
{ property: 'name', assign: 'john'},
{ property: 'owner', assign: 'doctor jones'},
{ property: 'type', assign: 'man' }
],
[
{ property: 'name',assign: 'rose' },
{ property: 'owner',assign: 'Nurse Juanita ' },
{ property: 'type',assign: 'female' }
]
]
Output
Console.log(makeAnimals(arr))
{
'0': { name: 'john', owner: 'doctor jones ', typ: 'make ' },
'1': { name: 'rose', owner: 'nurse Juanita ', type: 'female' }
}
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
