如何使用javascript在具有动态键和动态值的数组中创建动态数组?
例如,请查看以下我想要的内容:
Studentslist
Student Info 1
"name" => "varun",
"age" => "24"
Student Info 2
"name" => "Kumar",
"age" => "25"
添加有关此问题的更多信息
我有一个像这样的单选按钮
<input type="radio" value="student1" id="student1" name="student1group1"/>
<input type="radio" value="student2" id="student1" name="student1group1"/>
<input type="radio" value="student3" id="student2" name="student1group2"/>
<input type="radio" value="student4" id="student2" name="student1group2"/>
当单击任何单选按钮时,我需要在数组中设置一个数组,例如在单击student1group1
2 个单选按钮中的任何一个时,我需要获取如下所示的数组
Studentslist
Student Info 1
"name" => clicked value of the radio button,