DEV Community

Discussion on: A program of calc sum ➕ with new and smart code in JavaScript 🔥.

ttatsf profile image
Info Comment hidden by post author - thread only visible in this permalink
tatsuo fukuchi

It's a "closure" matter, and you can do it more simply.

const sum = ( x => y => x += y )(0)
Enter fullscreen mode Exit fullscreen mode

You can directly treat parameter as a variable.

Some comments have been hidden by the post's author - find out more