I have a function called myObject
that returns an object by taking two parameters, the name of the key
and the value
.
The problem is that the parameters we give as key
and value
only consider and display the value
but not the key
.
You can see the output in the console.
please guide me
The desired output in the console : {"Number":12345}
const myObject = (key, value) => {
return { key: value }
};
console.log(myObject("Number", 12345));