티스토리 뷰

JavaScript

Rest parameter

seoca 2020. 8. 26. 22:22

 

 

Use Rest parameter(...args) to allow accepting an indefinite number of arguments and store them in an array

 

const arrow = (...args) => {

    console.log(args);

}


arrow(1,2,3,4);

 

 

output

[1,2,3,4] - it returns array 

 

'JavaScript' 카테고리의 다른 글

Spread Operator  (0) 2020.12.26
Type Conversion in Javascript (number, string)  (0) 2020.09.15
How to run your Javascript test code in Chrome  (0) 2020.07.28
Single-thread in JavaScript  (0) 2019.09.06
Promise  (0) 2019.09.04