Method: Array#unshift
- Defined in:
- lib/source/ruby.rb
#unshift(*args) ⇒ Object
call-seq:
ary.unshift(obj, ...) -> ary
Prepends objects to the front of ary, shifting the indices of ary’s other elements up one, then returns ary.
a = %w(b c)
a.unshift('a') #=> ["a", "b", "c"]
a.unshift(1,2,3) #=> [1, 2, 3, "a", "b", "c"]
2854 2855 2856 2857 |
# File 'lib/source/ruby.rb', line 2854 def unshift(*args) `for(var i=args.length;i>0;){this.unshift(args[--i]);}` return self end |