The Curious Case of the Missing Method

Difficulty:
Elementary

Tags:
enumerables, arrays

Instructions:
Stop this code from throwing an exception. Hint: find the right seven-letter array method: http://ruby-doc.org/core-1.9.3/Array.html

Code:
assert_equal [1, 4, nil, 9, 16, nil].___.inject(0) {|sum, number| sum + number}, 30

Your Solution

Ruby 1.9.3

Back to Problems