Ad Code

Responsive Advertisement

Array Clone in java script


Array Clone Method:

function cloneObject(source) {
    for (i in source) {
        if (typeof source[i] == 'source') {
            this[i] = new cloneObject(source[i]);
        }
        else {
            this[i] = source[i];
        }
    }
}

use of array clone method:

var arr1 = ['a','b','c'];

var objArray = new cloneObject(arr1);

Post a Comment

2 Comments

  1. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. 作业代写

    ReplyDelete

Close Menu