What is the result of using the spread operator on a string, such as ...“JavaScript”?

  • ["J", "a", "v", "a", "S", "c", "r", "i", "p", "t"]
  • "JavaScript"
  • SyntaxError
  • undefined
When you use the spread operator on a string in JavaScript, it splits the string into an array of individual characters. So, the correct result is an array of characters as shown in Option 1. The other options are not the expected outcome for the spread operator on a string.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *