DEV Community

Discussion on: Suggestions for using `...arguments` while working with functions in javascript.

 
shalvah profile image
Shalvah • Edited

Combining Meghan's two earlier responses, a better way would be:

passToAnotherFunc(...args) {
  handleItSomewhere(...args);
}

But I feel it's unlikely you'd need to write this kind of code. Could you give a real-world example?

Thread Thread
 
nektro profile image
Meghan (she/her)

@antjanus it's not deprecated per-se but it is disabled in strict and module mode.

@shalvah +1 because instead of calling passToAnotherFunc to call handleItSomewhere, why not just call handleItSomewhere?

Thread Thread
 
antjanus profile image
Antonin J. (they/them)

I had no idea it was disabled in strict/module mode!