time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

repl.txt (1657B)


      1 
      2 {{alias}}()
      3     Stack constructor.
      4 
      5     A stack is also referred to as a "last-in-first-out" queue.
      6 
      7     Returns
      8     -------
      9     stack: Object
     10         Stack data structure.
     11 
     12     stack.clear: Function
     13         Clears the stack.
     14 
     15     stack.first: Function
     16         Returns the "newest" stack value (i.e., the value which is "first-out").
     17         If the stack is empty, the returned value is `undefined`.
     18 
     19     stack.iterator: Function
     20         Returns an iterator for iterating over a stack. If an environment
     21         supports Symbol.iterator, the returned iterator is iterable. Note that,
     22         in order to prevent confusion arising from stack mutation during
     23         iteration, a returned iterator **always** iterates over a stack
     24         "snapshot", which is defined as the list of stack elements at the time
     25         of the method's invocation.
     26 
     27     stack.last: Function
     28         Returns the "oldest" stack value (i.e., the value which is "last-out").
     29         If the stack is empty, the returned value is `undefined`.
     30 
     31     stack.length: integer
     32         Stack length.
     33 
     34     stack.pop: Function
     35         Removes and returns the current "first-out" value from the stack. If the
     36         stack is empty, the returned value is `undefined`.
     37 
     38     stack.push: Function
     39         Adds a value to the stack.
     40 
     41     stack.toArray: Function
     42         Returns an array of stack values.
     43 
     44     stack.toJSON: Function
     45         Serializes a stack as JSON.
     46 
     47     Examples
     48     --------
     49     > var s = {{alias}}();
     50     > s.push( 'foo' ).push( 'bar' );
     51     > s.length
     52     2
     53     > s.pop()
     54     'bar'
     55     > s.length
     56     1
     57     > s.pop()
     58     'foo'
     59     > s.length
     60     0
     61 
     62     See Also
     63     --------
     64