Js course i got confused, help me out pls if u can

function checkObj(obj, checkProp) {
// Only change code below this line
var obj = {
gift:“pony”,
pet:“kitten”,
bed:“sleight”,
city:“Seattle”,
};
if (obj.hasOwnProperty(checkProp)) {
return obj[checkProp];
}else{return “Not Found”;}
// Only change code above this line
}

i know few lession before fcc explained how to remove from var, but if i do so i dont pass the gift return pony, while now i cant have result gift not found
im confused
can someone help me out pls?
i think i would need 3 var obj… dont remember for such thing, but ofc could just forgot about…
or i just can if else?

you don’t need to create any object, the object to test is passed in as function argument

1 Like

thank you, got it… today aint my brightest day till now but ill try to work on to change it
but somehow im still confused
i dont get the part how return for gift not found and pony same time only by change obj to checkObj
i still have a feeling i would need 3 checkObj or with if else or something to complete last task, but somehow i dont

each function call has a different object passed in, that’s how it can get different outputs even if
checkProp is the same

1 Like

i just were about to write that, i got it and it was hit hard
time for a cofee and wash face
thank u a lot again

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.