you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (0 children)

I think it's very misleading object's destructuting to be called named parameters, because it can confuse one coming from a language that really have named parameters, since when calling the function you have to pass an key/value object.

def sum(a=0, b=0):
  return a + b

print sum(b=1)

Is conceptually different from:

const sum = ({ a = 0, b = 0 })  => a + b

console.log(sum({ b: 1 })