I'm trying to create an array of arrays to be used in a JavaScript function.
Here is the format of the array that I'm trying to create:
[[1,1],[2,3],[3,6],[4,10],[5,15],[6,21]]
Here is the ruby code to create the array:
total=0
foo=[]
(1..6).each do |number|
foo.push [number, total+=number]
end
puts foo
Here is the output of puts foo:
1
1
2
3
3
6
4
10
5
15
6
21
Any ideas how to output the correctly formatted array?
foo.inspectorfoo?foo:)to_sis equivalent tojoin, but in 1.9+ it's equivalent to callinginspect.