Skip to content

Latest commit

 

History

History
16 lines (13 loc) · 411 Bytes

push_a_hash_an_object_into_array.md

File metadata and controls

16 lines (13 loc) · 411 Bytes

Description

You are trying to put a hash in ruby or an object in javascript or java into an array, but it always returns error, solve it and keep it as simple as possible!

items = Array.new
items.push {:a => "b", :c => "d"}

My Solution

items = Array.new
items << {:a => "b", :c => "d"}