How to handle this case in javascript?

Ok I will follow this link