How to decode HTML entities like ' to its original character?
In browsers we can create a DOM to do the trick (see here) or we can use some libraries like he
In NodeJS we can use some third party lib like html-entities
What if we want to use plain JavaScript to do the job?
There are many similar questions and useful answers in stackoverflow but I can't find a way works both on browsers and Node.js. So I'd like to share my opinion.
I have posted my opinion as an answer below. I hope it can be a helping hand for someone. :)