Add #39 JavaScript solution