Tutorial JavaScript: Cara membuat senarai menggunakan matriks
P粉617237727
2023-09-06 09:54:44
<p><strong>我有一个像这样的数组</strong></p>
<pre class="brush:php;toolbar:false;">const input_array= [
["hitam", "biru"],
["besar", "sederhana"],
["a", "b", "c"]
//... adakah ia dinamik boleh ditambah banyak baris
];</pre>
<p><strong>我该如何得到一个像这样的数组:</strong></p>
<pre class="brush:php;toolbar:false;">const finallist = [
["hitam", "besar", "a"],
["hitam", "besar", "b"],
["hitam", "besar", "c"],
["hitam", "sederhana", "a"],
["hitam", "sederhana", "b"],
["hitam", "sederhana", "c"],
["biru", "besar", "a"],
["biru", "besar", "b"],
["biru", "besar", "c"],
["biru", "sederhana", "a"],
["biru", "sederhana", "b"],
["biru", "sederhana", "c"],
]</pre>
<p><strong>请记住input_array是动态的</strong></p>
<p><strong>请告诉我如何做到这一点</strong></p>
Anda boleh melakukan sesuatu seperti ini:
Sila lihat ini, ia mungkin membantu: