Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started