【发布时间】:2015-07-08 19:53:26
【问题描述】:
【问题讨论】:
-
这可能是重复的,但它比其他问题有更好的答案,我认为我们应该重新打开它
标签: javascript string
【问题讨论】:
标签: javascript string
"hello".split('').join(' '); // "h e l l o"
【讨论】:
var text = "hello";
var betweenChars = ' '; // a space
alert(text.split('').join(betweenChars));
【讨论】:
尝试:
var hello = 'hello';
var test = '';
for(var i=0; i<hello.length; i++){
test += hello.charAt(i) + ' ';
}
alert(test);
【讨论】: