2 ms·
That doesn't seem that obvious to me. You could have a setter that just calls exit and terminates the whole program.
by dminik 1y ago
That doesn't seem that obvious to me. You could have a setter that just calls exit and terminates the whole program.
- dvt 1y agoYeah, this is actually a good point, could have a custom setter theoretically that simply looks like assignment, but does some fancy logic. const location = { set current(where) { if (where == "boom") { throw new Error("Uh oh"); // Control flow breaks here } } }; location.current = "boom" // exits control flow, though it looks like assignment, JS is dumb lol