question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Testing Objects for Properties

See original GitHub issue

Challenge [Testing Objects for Properties] User Agent is: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:43.0) Gecko/20100101 Firefox/43.0.

Please describe how to reproduce this issue, and include links to screenshots if possible.

My code:```javascript

// Setup var myObj = { gift: “pony”, pet: “kitten”, bed: “sleigh” };

function checkObj(checkProp) { // Your Code Here

if (myObj.hasOwnProperty(“checkProp”)=== true); {return myObj[checkProp];}
return “Not Found” ; }

// Test your code by modifying these values checkObj(“house”);

I'm using a firefox browser and cannot get a screen-shot to paste - sorry.  My issue is the final  'return "Not Found";  ' statement in this exercise will not execute when the condition is false.  I checked the format of this exercise with one from a previous exercise (Chaining If Else Statements), and it is the same basic format once you comment out the extra if-else statements there.  I did not find any other solutions in Git Hub or elsewhere online. I did notice some people used an 'else' in front of ' return "Not Found" ;  ', but when I attempt it, I get an error, otherwise, the editor does not show any other errors for my code.  

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:6
  • Comments:16 (2 by maintainers)

github_iconTop GitHub Comments

56reactions
anastasi5commented, Sep 20, 2016

OK, this is another example of not getting enough information from the sample code. Nowhere in there is the suggestion that an if/return/else statement should be used…

43reactions
Pixiwixcommented, Mar 7, 2017

I’m not sure where else to put this piece of .02, but honestly, the chat room is NOT helpful. For people who are really trying hard to put in the effort that it takes to learn to code (for me, with ZERO tech background), it seems like there would be a forum available to help. This feels like the 50 millionth time I’ve tried finding help through the forums and it’s really offputting to just see moderators telling people to use the (useless and unhelpful) chat room. It’s frustrating learning to code as it is, and this insistence on using a form of “help” that isn’t helpful is making it so much worse.

Read more comments on GitHub >

github_iconTop Results From Across the Web

freeCodeCamp Challenge Guide: Testing Objects for Properties
Testing Objects for Properties Hints You do not need to declare any additional variables or define any objects inside of your function.
Read more >
javascript (Testing objects for properties) - Stack Overflow
The hasOwnProperty(propertyName) method is used to determine if the property of a given object exists, and returns true ...
Read more >
Testing Objects for Properties / FreeCodeCamp / solve
Sometimes it is useful to check if the property of a given object exists or not. We can use the .hasOwnProperty(propname) method of...
Read more >
Testing Objects for Properties - Scrimba.com
console ; // Setup ; var myObj = { ; gift: "pony", ; pet: "kitten", ; bed: "sleigh".
Read more >
Page Object Properties | TestComplete Documentation
This category includes properties that TestComplete applies to all test objects. Name, Description. _NewEnum, Returns an enumerator for the collection of ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found