扫码关注官方订阅号
var creathtml = [
"我的" ].join(''); creathtml+=[ "你的" ].join('');
我的
你的
join('')里面为什么还有一个空格引号。
人生最曼妙的风景,竟是内心的淡定与从容!
<script type="text/javascript"> var arr = new Array(3) arr[0] = "George" arr[1] = "John" arr[2] = "Thomas" document.write(arr.join())//George,John,Thomas document.write(arr.join("."))//George.John.Thomas document.write(arr.join(" "))//George John Thomas document.write(arr.join(""))//GeorgeJohnThomas </script>
首先,我不推荐你那种写法。 arr.join("分隔符");数组的每一个元素都会用这个分隔符分开,然后拼接成一个字符串
微信扫码关注PHP中文网服务号
QQ扫码加入技术交流群
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
PHP学习
技术支持
返回顶部
首先,我不推荐你那种写法。 arr.join("分隔符");数组的每一个元素都会用这个分隔符分开,然后拼接成一个字符串