javascript array and canvas