There is a line:
var s = "строка"; You need to get an array of characters from this string:
'с' 'т' 'р' 'о' 'к' 'а' How to do it?
There is a line:
var s = "строка"; You need to get an array of characters from this string:
'с' 'т' 'р' 'о' 'к' 'а' How to do it?
The split () method splits a string in the specified selector.
var s = "строка", //Укажем пустую строку чтобы разбить по символам arr = s.split(''); console.log(arr); In ES2015, you can Array.from()
console.log(Array.from("строка")) It is possible through RegExp:
var s = "строка", arr = s.match(/./g); console.log(arr); Source: https://ru.stackoverflow.com/questions/702900/
All Articles