array1 = [1,2,3,4,5];
array2 = ["one","two","three","four","five"];
我想array3
其中與第一(和其他人)的array2
元素等的array1
所有元素
例如:
array3 = ["one 1", "two 1", "three 1", "four 1", "five 1", "one 2", "two 2", "three 2", "four 2", "five 2"...]
我明白我需要使用循環,但我不知道該怎麼做。
如果你是下劃線或lodash,簡單['zipWith'(https://lodash.com/docs#zipWith)會工作:'_.zipWith(數組1,數組2,功能( a,b){return a +''+ b;});' –