I can’t see any problem.
Because checkProp
is a variable you have to use bracket notation:
obj[checkProp]
Hi @gtrman97 !
Please avoid posting screenshots for code.
As the problems become more complex it will become more difficult to debug your code from a screenshot.
In the future, If you have a question about a specific challenge as it relates to your written code for that challenge, just click the Ask for Help button located on the challenge. It will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Thank you.
I don’t understand, this is legal right?
var myObj = {
prop1: "val1",
prop2: "val2"
};
var prop1val = myObj.prop1;
var prop2val = myObj.prop2;
So if obj is an object, and I’ve determined that checkprop is a property in that object, then why can’t I use dot notation?
You can only use dot notation with the exact literal name of the property, not with variables.
Have you? Is checkprop
the property?
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.