Arrays In Javascript.

Consider this small code sample in Javascript.


var arrayOfNumbers=[1,2,3,4,5,6,78];
for(var index in arrayOfNumbers){
    console.log(index+1);
};

Output of this snippet will be

01
11
21
31
41
51
61

Now this is because Arrays are treated as Objects in Javascript, so index is iterating over keys in an object. In this case the object will be represented as follows

arrayOfNumbers={ "0":1,
                 "1":2,
                 "2":3,
                 "3":4,
                 "4":5,
                 "5":6,
                 "6":78}

Implemet Stack in python

  class Stack : def __init__ ( self , data ): self . stack = [] if ( data ): self . stack . append ( da...