Getting Started with Modern JavaScript — Spread vs Rest

Definitions

Spread Operator

Arrays

const array = [1, 2, 3];
console.log(…array);
// -> 1 2 3
const array = [4, 2, 9, 5];
Math.max(…array); // -> 9

Objects

Rest Parameter

Conclusion

Getting Started Series

Frontend Architect • JavaScript Enthusiast • Educative.io Author • ngVikings organizer.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store