Hacker News new | ask | show | jobs
by DoesntMatter22 1020 days ago
> - I thought JavaScript didn't have a `goto` statement? [I googled this to confirm it doesn't]

Goto is not a statement. It's a function. Frameworks can have functions...

1 comments

Goto is control flow. You can’t do control flow with function calls in the sorts of languages we’re talking about, so goto has to be built into the language, typically as a statement.

(In some of these languages you can do awful hacks like using hooks intended for debuggers <https://entrian.com/goto/> or rewriting bytecode <https://github.com/snoack/python-goto>, and frankly what Svelte does is quite similar, just implemented as a compilation step rather than at runtime.)

I assumed this was talking about the goto statement in Svelte which is navigation method. If not that's fine