Add #18 JavaScript solution