Do we have to santise html passing into Javascript ? How?

No, in fact sanitizing the string you listed would remove the HTML. The sanitizing functions are meant for user inputted data like a form submission. You can’t always trust the information they pass through. Sometimes hackers may input malicious code that would be executed on your site after submission if you did not run it through a sanitizing function first.