How to handle this case in javascript?

you have to fix several typos, then it works.