Practise Question of Javascript

Note: Please Check the console for output

Q.2

Ques: Write a function to render the following pattern in the console:
* * * * *
* * * *
* * *
* *
*
The function needs to take a number as a parameter which represents how many asterisks are rendered on the first row.

Q.3

ques: Define an object containing information about yourself. The object needs to include 'name', 'address', 'emails', 'interests' and 'education'. The 'education' key needs to be an array of objects containing keys 'name' and 'enrolledDate'.

Q.4

Ques: Write a function that searches for an object by a specific key value in an array of objects:

Q.5

Ques: Write a function that transforms an array of inputs into a new array based on a provided transformation function. var numbers = [1, 2, 3, 4]

Q.6

Ques: Write a program to sort an array of object by a target key. The original array should remain unchanged.

Q.7

write a program to normalize a given input to get the expected output.
// From this
var input = {
'1': {
id: 1,
name: 'John',
children: [
{ id: 2, name: 'Sally' },
{ id: 3, name: 'Mark', children: [{ id: 4, name: 'Harry' }] }
]
},
'5': {
id: 5,
name: 'Mike',
children: [{ id: 6, name: 'Peter' }]
}
};
// To this
var output = {
'1': { id: 1, name: 'John', children: [2, 3] },
'2': { id: 2, name: 'Sally' },
'3': { id: 3, name: 'Mark', children: [4] },
'4': { id: 4, name: 'Harry' },
'5': { id: 5, name: 'Mike', children: [6] },
'6': { id: 6, name: 'Peter' }
};