Show Output
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JavaScript ES6 Get Extra Function Arguments with Rest Parameter</title> </head> <body> <script> function myFunction(a, b, ...args) { return args; } document.write(myFunction(1, 2, 3, 4, 5)); // 3,4,5 document.write("<br>"); document.write(myFunction(-7, 5, 0, -2, 4.5, 1, 3)); // 0,-2,4.5,1,3 </script> </body> </html>