一个数组num,另外一个数组same,拼接成res
let num=[73, 74, 75, 76]
let same=[76, 79, 83, 89]
let res="M 73,76 L74,79 L75,83 L76,89"
一个数组num,另外一个数组same,拼接成res
let num=[73, 74, 75, 76]
let same=[76, 79, 83, 89]
let res="M 73,76 L74,79 L75,83 L76,89"
<script>
let num = [73, 74, 75, 76]
let same = [76, 79, 83, 89]
var arr =[]
for (var i = 0; i < num.length; i++) {
arr.push(`${i == 0 ? 'M ' : 'L'}${num[i]},${same[i]}`);
}
var s = arr.join(' ')
alert(s)
</script>