When I started working with Python, *args was very handy and I started to miss it in my Javascript projects. Only recently, I found out you can get an arguments object of the function’s arguments like this:
function func() { console.log(arguments); // outputs: ["Earth", "Wind", "Fire"] } func("Earth", "Wind", "Fire")
Nice for functions where you want a flexible argument length!
Leave a Reply