Updated Solution for JavaScript Exercise1