While Loop Through Array Javascript Methods