Solution to JavaScript Exercise3