+ 1
How to pass an unknown numner of arguments in a javascript function?
I tried browsing and found that we can do this by: function func(...x) { } But it doesn't seem to work !
3 Respostas
+ 3
You can see my example
https://code.sololearn.com/WzP5WAVV0H31/?ref=app. Also you can find more info here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments. Hope it helps you :)
+ 1
Try making the argument an array, then loop through each key of the array in your function, stopping at array.length.
+ 1
I made you a demo.
https://code.sololearn.com/WefAf893I56c/?ref=app