Solution to JavaScript Exercise4