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

Now replace

  def to_int(a, b):
    ...
with the JS semantic equivalent of

  def to_int(*args):
    ...
because that's how JS function declarations work. You simply have the option to assign names to positional parameters, i.e.

  function fn(a, b) {
    comnsole.log(a, b)
  }
is just syntactic sugar for

  function fn() {
    const a = arguments[0]
    const b = arguments[1]
    console.log(a, b)
}

and that's what people seem to struggle with and argument over for whatever strange reason.



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

Search: