You are not using Array functionality - just Object functionality. In JavaScript Object is an associative array - you use Array for arrays indexed by integers. If you did var firstArray = new Array(); firstArray.
Push("sam"); firstArray. Push("kam"); var secArray = new Array(); secArray. Push("sam"); secArray.
Push("kam"); var res = firstArray. Concat(secArray) then concat would work as expected. To merge associative arrays, do: for (attr in src_array) { dest_arrayattr = src_arrayattr; } This will of course overwrite existing keys in dest_array which have counterparts in src_array.
You are not using Array functionality - just Object functionality. In JavaScript, Object is an associative array - you use Array for arrays indexed by integers. If you did var firstArray = new Array(); firstArray.
Push("sam"); firstArray. Push("kam"); var secArray = new Array(); secArray. Push("sam"); secArray.
Push("kam"); var res = firstArray. Concat(secArray); then concat would work as expected. To merge associative arrays, do: for (attr in src_array) { dest_arrayattr = src_arrayattr; } This will of course overwrite existing keys in dest_array which have counterparts in src_array.
Thanks for the reply.. this is wat I expected... – RameshVel Aug 20 '09 at 12:12.
Try this, var firstArray = new Array("sam","kam"); var secArray = new Array("sam","kam"); var res = firstArray. Concat(secArray).
JavaScript doesn't have associative arrays, it has object hashes. You're creating an array and assigning values to some of it's properties, not in the array itself. Your concat will not work because the values are object properties.To do a concat the way you have it you'll need to combine the two objects.
YUI, jQuery, and the other JavaScript frameworks provide helpful methods to do just that.
Strictly speaking those aren't associative arrays at all: they are arrays of zero length, with additional named properties. Assigning those properties works because arrays are also objects in JavaScript; but that doesn't make them an associative array. It's better to look on them as hashes.
Array methods such as concat will only work with the numerically-indexed elements of arrays, not with the properties of objects - even if those objects happen to be arrays.
Arrays in JavaScript have only numerical keys. Only objects can have non numerical properties. So try this instead: var firstArray = {}; firstArray.
C1 = "sam"; firstArray. C2 = "kam"; var secArray = {}; secArray. C3 = "sam"; secArray.
C4 = "kam"; for (var prop in secArray) { if (secArray. HasOwnProperty(prop)) { firstArrayprop = secArrayprop; } }.
You're looping over the properties in the second array and then calling "hasOwnProperty" on the second array with the value from the first loop. Did you mean to test "hasOwnProperty" on the first array? – doomspork Aug 20 '09 at 11:58.
In JavaScript, Object is an associative array - you use Array for arrays indexed by integers. Then concat would work as expected. This will of course overwrite existing keys in dest_array which have counterparts in src_array.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.