title: peek operation in stack using javascript
body: <p>How can I get the first element from my stack
  here is my code</p>
  
  <pre><code>var stack = [];
  stack.push(id1);
  stack.push(id2);
  </code></pre>
  
  <p>I know there is something like peek in java. Is there any similar method in JS using which i can get the topmost element?</p>