Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yeah, 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


Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: