✅ – Script – 21-22 Nov 7
How do I check if boolean object key contains value?
Category is a string, so I just check if it contains any value and then I am able to update it
but approvedForMenu is a boolean. So my ternary operator is checking for true or false instead.
I can change the value to true but I cant change it back to false.
How do I write the code so I can be able to change it back to false?
4 Replies
You can use
??
, which checks for null/undefined instead of truthiness/falsiness
@Script https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescingtruly the learning dont stop.
haha
thanks Chris
This question has an answer! Thank you for helping 😄
If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1039288869780197446
This thread hasn’t had any activity in 12 hours, so it’s now locked.
Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/1039288869780197446
Question not getting answered? Maybe it's hard to answer, or maybe you asked at a slow time. Check out these resources for help asking a good question:
https://stackoverflow.com/help/how-to-ask
http://wp.me/p2oIwo-26