Rest operator in JavaScript

Rest operator is similar to spread operator its an es6 feature that allows converting arguments to an array of values;

Syntax of spread operator is as follows;

function spr(...params) {

// [1, 2, 3]

You can use rest operator among other arguments

function sprr(args, ...params) {



spr('foo', 1, 2, 3)

// [1, 2, 3]

More information:
Rest parameters MDN


Popular posts from this blog

Open-graph meta data tags introdution

What is 'this.' keyword in JavaScript

How to create zip archives in nodejs

what is 'array.includes' function in JavaScript

How to build a twitter retweet bot using JavaScript