Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaScript: Unicode space character

I want to insert the space character into the innerHTML of a DOM element, but the space character must be declare in Unicode syntax.

For example, something like this: ...innerHTML += '\u83838383';

like image 887
JamesBrownIsDead Avatar asked Feb 05 '10 04:02

JamesBrownIsDead


People also ask

Is space a character in JavaScript?

The RegExp \s Metacharacter in JavaScript is used to find the whitespace characters. The whitespace character can be a space/tab/new line/vertical character. It is same as [ \t\n\r].

Can I use Unicode in JavaScript?

In Javascript, the identifiers and string literals can be expressed in Unicode via a Unicode escape sequence. The general syntax is \uXXXX , where X denotes four hexadecimal digits. For example, the letter o is denoted as '\u006F' in Unicode. Hence, ​to write the letter “foo” in Unicode, we can use the following code.

What is space in JavaScript?

Whitespace refers to characters which are used to provide horizontal or vertical space between other characters. Whitespace is often used to separate tokens in HTML, CSS, JavaScript, and other computer languages.


1 Answers

I am not quite sure what character you are hoping to get with 8383 - not to mention 83838383, but it certainly doesn't seem to be the space character for any encodings I am familiar with. Are you by chance looking for:

  • ASCII Space =   = \u0020
  • En Space =   = \u2002
  • Em Space =   = \u2003
like image 151
Goyuix Avatar answered Sep 22 '22 18:09

Goyuix