Testing Objects for Properties
See original GitHub issueChallenge [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:
- Created 8 years ago
- Reactions:6
- Comments:16 (2 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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…
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.