The first parameter is an object, the second parameter will be a
string and the third parameter will be a value. Return the object
adding the second parameter as a key using the third parameter as its value.
Some reason I can only ever either set the string or key and not both and everything I find online does the same. X.X Starting to really hate Javascript Objects and value Python's classes.
Examples:
let obj = {}
setKeyInObject(obj, "apple", "yum"); // => {apple: "yum"}
let obj1 = {str: "hello"}
setKeyInObject(obj1, "num", 3); // => {str: "hello", num: 3}
function setKeyInObject(obj, string, value) {
let obj1 = {string: value}
return obj1;
}
What I have tried:
Finally figured this much out but now it fails for the second test.
function setKeyInObject(obj, string, value) {
return obj[string] = {[string]: value};
}