Testing Objects for PropertiesPassed

Tell us what’s happening: Unexpected token (14:0)

Your code so far

// Setup
var myObj = {
gift: "pony",
pet: "kitten",
bed: "sleigh"

function checkObj(obj, checkProp) {
// Only change code below this line
if(myObj.hasOwnProperty(obj) == checkProp){
return myObj.hasOwnProperty()}
// Only change code above this line

checkObj(myObj, "gift");

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36.

Challenge: Testing Objects for Properties

Link to the challenge:

Let’s play a game spot the extra symbol.
Hint: it’s closing

1 Like

Hi @KittyKora, I can’t actually spot the symbol but I’ll try once more.

It will most likely not pass. Only solute the unexpected token

if(myObj.hasOwnProperty(obj) == checkProp){
  You are checking if hasOwnProperty has property obj
  but are then comparing it to checkProp is that what you want?
   return that property's value.
return myObj.hasOwnProperty()}
If not, return "Not Found".
1 Like

Thanks @KittyKora. Now I’m able to spot the error.