FrontendDeveloper.in

JavaScript question detail

What is the output of below spread operator array

[..."John Resig"];

The output of the array is ['J', 'o', 'h', 'n', ' ', 'R', 'e', 's', 'i', 'g']

Explanation: The string is an iterable type and the spread operator within an array maps every character of an iterable to one element. Hence, each character of a string becomes an element within an Array.

Back to all JavaScript questions
Get LinkedIn Premium at Rs 399