Gold rush - beginner. Code problems

On a related note:
http://discourse.codecombat.com/t/mad-maxer-help-with-arrays/2700/2?u=j_f_b_m