任何人都可以帮助我。
我该如何转换
var array_name = ["Name1", "Name2"];
var array_score = [8, 9];
就像这样
var mydata = [ ["Name1", "Name2"],[8,9] ]
我希望我的array_name和数组得分像mydata数组一样连接在一起。 谁能帮我这个,?感谢
答案 0 :(得分:6)
.lable_time select{
padding: 15px 30px;
margin: 0px 0px 0px 0px;
width:50%;
font-family: 'Oxygen', sans-serif;
color:#5585C8;
background: white;
border: 1px solid #2744B8;
cursor: pointer;
font-size: 18px;
transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease-out;
-ms-transition: all 0.5s ease-out;
-o-transition: all 0.5s ease-out;
outline:none;
-webkit-appearance: none;
border-width:0px;
}
.stime{
float: left;
margin: 30px 0px 0px 0px;
width: 350px;
}
.stime_meridian{
float: left;
margin: 30px 10px 0px -170px;
width: 220px;
border-spacing: 30px 10px;
}
.time{
float: left;
margin: 30px 0px 0px -170px;
width: 350px;
}
.time_meridian{
float: left;
margin: 30px 0px 0px -170px;
width: 220px;
}
答案 1 :(得分:3)
希望此代码段有用
var array_name = ["Name1", "Name2"];
var array_score = [8, 9];
var mydata =[];
mydata.push(array_name,array_score);
console.log(mydata)
答案 2 :(得分:0)
以下是一些例子:
var array_name = ["Name1", "Name2"];
var array_score = [8, 9];
/*Example 1 :*/
var mydata = [];
mydata = [array_name,array_score];
console.log(mydata);
/*Example 2 :*/
var mydata = [];
mydata[0] = array_name;
mydata[1] = array_score;
console.log(mydata);
/*Example 3 :*/
var mydata = [];
mydata.push(array_name); /*OR mydata.push(arr1,arr2,....);*/
mydata.push(array_score);
console.log(mydata);