In the fiddle - http://jsfiddle.net/vwwkf18c/ or below code snippet -
var a = [3, 4];
var b = [6, 2];
var c = $.extend({}, a, b);
alert(c[1]); //alerts 2
alert(a); //alerts array a contents
alert(c); //does not return contents of c
My questions - 1) After what has been alerted, we can infer that "c" is an object but not an array object. Please confirm. 2) Secondly it is said that internal representation of an array is an object literal, is that right? Which means that array "a" would be stored as given below -
var a = {
0: 3,
1: 4
}
Is it right? 3) How is a or b stored internally and how is it different from the internal representation of "c"?
alertis not a debugging tool, if you learn to use the console, it will show things more clearly.$.extendcreates objects.cis now:Object { 0: 6, 1: 2 }. That being said, this question isn't really the right fit for SO. Did you have a specific programming question or just theoretical stuff?console.log(), notalert().