# Spread operator for strings in JavaScript

The spread operator applied to a string splits that string character by character:

`...'abcde'; // will split the string into characters separated by commas: //'a','b','c','d','e'`

The result of such a split can be passed to the function parameters:

`function func(s1, s2, s3, s4, s5) { return s1 + '-' + s2 + '-' + s3 + '-' + s4 + '-' + s5; } console.log( func(...'abcde') ); // shows 'a-b-c-d-e'`

And you can convert this result to an array:

`let arr = [...'abcde']; // gets an array ['a', 'b', 'c', 'd', 'e']`

Without running the code, determine what will be output to the console:

`let arr = [...'12345']; console.log(arr);`

Without running the code, determine what will be output to the console:

`let arr = ['a', ...'12345']; console.log(arr);`

Without running the code, determine what will be output to the console:

`let arr = [...'12345', ...'56789']; console.log(arr);`

Without running the code, determine what will be output to the console:

`let arr1 = ['a', 'b', 'c']; let arr2 = [...arr1, ...'12345']; console.log(arr2);`
← →
↑
en ru