update the js

moving from var to let where applicable
variable deconstruction for parameters
and lots of inline arrow functions