<script>var arr=['red','bule','yellow','black'];var str='';for(var i=0;i<length;i++){ str+=arr[i]+'|' //str+=arr[i]相当于str=str+arr[i]}console.log(str)</script>