js合并两个数组生成合并后的key:value数组方法
2020-04-23
前端
jQuery
3670
0
js合并两个数组生成合并后的key:value数组方法// var activeSubjectsName = ["JAVA", "PHP", "Android", "IOS", "Python"];// var activeSubjectsNum = [46, 2, 2, 28, 29];// var activeSubjectsArr = [];for (var i = 0; i < activeSubjectsName.length; i++) { console.log(i); var activeSubjectsObject = {}; for (var j = 0; j < activeSubjectsNum.length; j++) { ;if (i == j) { ; activeSubjectsObject.name = activeSubjectsName[i]; ; activeSubjectsObject.value =