JavaScript solutions for the first three Numbers problems