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.
Loading...
Related Quiz
- In the context of testing, what is the main difference between a mock and a stub?
- How does the Event Loop handle asynchronous tasks in Node.js?
- To handle uncaught exceptions in a Node.js application, you can use process.on('______', callback).
- How can prototype pollution vulnerabilities be mitigated in JavaScript applications?
- In Express.js, the all method can be used to handle all HTTP methods, and it is equivalent to the ______ method in terms of functionality.