Alright then, lets start with copy array a into b, by reusing and modifying memset.
function memcpy(dst, src, size) {
for (var i = 0; i < size; ++i) {
dst[i] = src[i];
}
}
Now, thats nice, but does not actually make sure that the arrays have the same CType, better add a check for that.