Working with Objects and Arrays Using Rest and Spread
Learn two modern techniques for working with arrays and objects in JavaScript. You can expand an array, object, or string using the spread operator .... Let’s start with an example for arrays: const a = [1, 2, 3]; To create a new array, you can use: const b = [...a, 4, 5, 6]; You can also create a copy of an array using: const c = [...a]; This also works for objects....