Insert Unicode character into JavaScript

后端 未结 4 2155
抹茶落季
抹茶落季 2020-11-27 03:09

I need to insert an Omega (Ω) onto my html page. I am using its HTML escaped code to do that, so I can write Ω and get Ω. That\'s all fine an

4条回答
  •  一个人的身影
    2020-11-27 03:28

    The answer is correct, but you don't need to declare a variable. A string can contain your character:

    "This string contains omega, that looks like this: \u03A9"
    

    Unfortunately still those codes in ASCII are needed for displaying UTF-8, but I am still waiting (since too many years...) the day when UTF-8 will be same as ASCII was, and ASCII will be just a remembrance of the past.

提交回复
热议问题