Dress to impress; reference error: shorts not defined


Could someone help me by telling me what the problem with the code below is? I keep getting a ReferenceError saying that shorts are undefined.

var suitcase = {
    shirt: "Hawaiian"

if (suitcase.hasOwnProperty(shorts)=== true){
    } else if (!suitcase.hasOwnProperty(shorts)){
    suitcase.shorts = "khaki";


Hello @netjumper97942,

Try replacing your else if (condition) with an else clause...


Getting the same error


Can you please post your updated code... Thanks!


I have figured out why you are unable to pass this exercise. It is because you haven't put "shorts" in quotes. It is a part of the .hasOwnProperty() method of classes...


LOL, so that's what it was! Thanks.


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