node string to chars with spaces in between 1

node string to chars with spaces in between

let str = 'hello'
str.split('').join(' '); // "h e l l o"

Here is what the above code is Doing:
1. str.split(”) splits the string into an array of characters.
2. .join(‘ ‘) joins the array of characters into a string, separated by a space.

Similar Posts