let thisArray = ['sage', 'rosemary', 'parsley', 'thyme'];Using spread syntax, we have just achieved an operation that would have been more complex and more verbose had we used traditional methods.
let thatArray = ['basil', 'cilantro', ...thisArray, 'coriander'];
// thatArray now equals ['basil', 'cilantro', 'sage', 'rosemary', 'parsley', 'thyme', 'coriander']
spreadOut
that returns the variable sentence
. Modify the function using the spread operator so that it returns the array ['learning', 'to', 'code', 'is', 'fun']
.
spreadOut
should return ["learning", "to", "code", "is", "fun"]
testString: assert.deepEqual(spreadOut(), ['learning', 'to', 'code', 'is', 'fun'], 'spreadOut
should return ["learning", "to", "code", "is", "fun"]
');
- text: The spreadOut
function should utilize spread syntax
testString: assert.notStrictEqual(spreadOut.toString().search(/[...]/), -1, 'The spreadOut
function should utilize spread syntax');
```