# Applying option if property is true or not set at all [closed]

I have a case where I want to apply a format if a property is true or if it is not set at all. Here is what I have:

var item = {};
item.name = "Option 1";

// user wants to add tags. if not set then default is to add tags
}
else {
// property is set and is not true. do not add tags
}


Is there any potential issues with doing it this way?

• If it is not set at all - does it not include undefined? – Avanthika May 16 '19 at 20:46
• Why have the else scope at all if it's no-op? – Mathieu Guindon May 16 '19 at 21:12
• @MathieuGuindon good point. lol i hadn't progressed that far in the code. – 1.21 gigawatts May 16 '19 at 21:49
• I'd think it's a bit early to have it peer reviewed then ;-) – Mathieu Guindon May 16 '19 at 21:50
• @Avanthika in JavaScript if the value is undefined the loose equality would catch it when using value==null. – 1.21 gigawatts May 16 '19 at 21:50