How do I move an element from an array to another array in javascript?

Posted by TiansHUo on Stack Overflow See other posts from Stack Overflow or by TiansHUo
Published on 2010-03-22T12:56:56Z Indexed on 2010/03/22 13:01 UTC
Read the original article Hit count: 240

Filed under:
|
|

My code is like

var shapes1 = [  r.image("node.gif",190, 100, 47, 45)];
var shapes2 =[];
for (var i = 0, ii = shapes1.length; i < ii; i++) {
    shapes1[i].mousedown(function(e){
        var temp=this.clone();
        shapes1.push(temp);
        //now I want to remove "this" from shapes1
        //and put it into shape2
        //HOW??
        isDrag=true;
        e.preventDefault();
    });
}

Maybe this is the wrong way to do it? I should be using a class instead, but isn't that for DOM items?

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about array