Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR RUBY

add key and value to first spot in hash ruby

hash1 = { two: 2, three: 3 }

#add a new key,value 
hash1 = Hash[:one,1].merge!(hash1) #=> {:one=>1, :two=>2, :three=>3}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #add #key #spot #hash #ruby
ADD COMMENT
Topic
Name
9+6 =