Add my solution to JavaScript exercise