Code Problems solved in Ruby and JavaScript