Why check the set before treating the value as new? Goal: Check whether a value is already stored before treating it as new.
A condition can be correct while the returned value is wrong.
Ask what should happen when a duplicate is found.
1// Goal: Check whether a value is already stored before treating it as new.2function starterExample() {3const seen = new Set([3]);4if (seen.has(3)) {5return true;6}7}
Why check the set before treating the value as new?