我在这里逐个获取这样的数组:
['test@test.com']
['test@test1.com']
['test@test2.com']
['test@test3.com']
如何将两个数组转换为单个数组?
['test@test.com','test@test1.com','test@test2.com']
以下是我的代码:
var email= myFirebased.ref().child('users');
tags.on("child_added", function(snapshot) {
var userkeys = snapshot.key;
var userName = snapshot.child("userName ").val();
var myObj = {
name: userName ,
keys:userkeys,
};
var arr = Object.keys(userName ).map(function(k) {return userName [k] });
for(var i=0;i<arr.length;i++){
$("#username").append('<option value ="'+ arr[i]+'"> '+ arr[i] +' </option>');
}
});