I have a single string with spaces. Like "Dmitry Vladimirovich Nikitin". My task is to trim a string and replace all spaces with '\n'.
So, as a result I will get:
Dmitry \n Vladimirovich \n Nikitin \n
var FIO = nameEmployer
console.log(nameEmployer.trim())
FIO = FIO.trim()
FIO = FIO.replace(/ /g, '\n')
As you see, I used '/ /g' expression here to replace all the spaces with '\n'.
But 1 single string (Dmitry Vladi Nikitin) appeared.
What's the problem?
` – Asons Jun 26 '18 at 09:54