var v=[];
'key1=1&key2=2'.replace(/key1=(\w+)/,function (i,i) {
v.push(i)
}).replace(/key2=(\w+)/,function (i,i) {
v.push(i)
});
console.log(v); // -> ["1", "2"]
//from jQuery(1.2.5)
(function( first, second ) {
var a, i = -1;
while (a = second[++i]) first[first.length] = a;
return first;
})([1,2,3], [4,5,6]);
// -> [1, 2, 3, 4, 5, 6]
//上の応用
var a, i = -1, tt = [1,2,0,4,5];
while (tt[++i] != undefined) console.log(tt[i]);
// -> 1 2 0 4 5
'key1=1&key2=2'.replace(/key1=(\w+)/,function (i,i) {
v.push(i)
}).replace(/key2=(\w+)/,function (i,i) {
v.push(i)
});
console.log(v); // -> ["1", "2"]
//from jQuery(1.2.5)
(function( first, second ) {
var a, i = -1;
while (a = second[++i]) first[first.length] = a;
return first;
})([1,2,3], [4,5,6]);
// -> [1, 2, 3, 4, 5, 6]
//上の応用
var a, i = -1, tt = [1,2,0,4,5];
while (tt[++i] != undefined) console.log(tt[i]);
// -> 1 2 0 4 5
コメントする