Solution to JavaScript Exercise1