Solutions to JavaScript exercises