Home > Article > Web Front-end > The most concise way to encode html strings in JavaScript_javascript tips
html string refers to a string with html special symbols such as '
If the string is very long and contains many special symbols, how can we transcode them all simply and efficiently? cycle? Regular expression? No need! Let’s take a look:
That’s all!
How to use: