js数组用逗号形式隔开
遍历数组:
let fh = ','; let tagArr = [ {id:1,tageName:"张三",age:10}, {id:2,tageName:"李斯",age:20}, {id:3,tageName:"李丽",age:30} ] let strTag = tagArr.map(function(obj,index){ if(obj!=null){ if(obj.tagName!=null){ return obj.tagName; }else{ fh = '' } }else{ fh = '' } }).join(fh); console.log(strTage,'>>>>');//结果:strTage = 张三,李斯,李丽