repl.txt (1849B)
1 2 {{alias}}() 3 Linked list constructor. 4 5 Returns 6 ------- 7 list: Object 8 Linked list. 9 10 list.clear: Function 11 Clears the list. 12 13 list.first: Function 14 Returns the last node. If the list is empty, the returned value is 15 `undefined`. 16 17 list.insert: Function 18 Inserts a value after a provided list node. 19 20 list.iterator: Function 21 Returns an iterator for iterating over a list. If an environment 22 supports Symbol.iterator, the returned iterator is iterable. Note that, 23 in order to prevent confusion arising from list mutation during 24 iteration, a returned iterator **always** iterates over a list 25 "snapshot", which is defined as the list of list elements at the time 26 of the method's invocation. 27 28 list.last: Function 29 Returns the last list node. If the list is empty, the returned value is 30 `undefined`. 31 32 list.length: integer 33 List length. 34 35 list.pop: Function 36 Removes and returns the last list value. If the list is empty, the 37 returned value is `undefined`. 38 39 list.push: Function 40 Adds a value to the end of the list. 41 42 list.remove: Function 43 Removes a list node from the list. 44 45 list.shift: Function 46 Removes and returns the first list value. If the list is empty, the 47 returned value is `undefined`. 48 49 list.toArray: Function 50 Returns an array of list values. 51 52 list.toJSON: Function 53 Serializes a list as JSON. 54 55 list.unshift: Function 56 Adds a value to the beginning of the list. 57 58 Examples 59 -------- 60 > var list = {{alias}}(); 61 > list.push( 'foo' ).push( 'bar' ); 62 > list.length 63 2 64 > list.pop() 65 'bar' 66 > list.length 67 1 68 > list.pop() 69 'foo' 70 > list.length 71 0 72 73 See Also 74 -------- 75