Rest parameter in JavaScript
Rest parameter in JavaScript
In this article we are goanna to see about Rest parameter in JavaScript and where we use these. which is most important when you are going to start your career in JavaScript. Please read and enjoy this article if you want to give any feedback about your experience, we welcome.
The rest parameter syntax allows us to represent an indefinite number of arguments as an array.
Syntax:
function function_name(para1, para2, …restparameter){
Block of statement;
}
function_name(args1, args2, args3,….);
Example:
function myfunction(a, b,...c){
document.write(a * b + "<br>");
document.write(c + "<br>");
}
myfunction(4, 3, 5, 6, 9, 10);
Tags:
JavaScript
0 comments
Please leave your comments...... Thanks