I find that when I escape numbers that start from 0 to 7 and alert them, I get a weird symbol:
alert( "\0" ); // or \1, \2, \3...\7

This is only visible when I alert it, but document.write and console.log won’t show it. Escaping numbers greater than 7 will appear fine. I’m using the latest version of Chrome. Why am I getting this weird character? Thanks.
How string literals are parsed in general is described in section 7.8.4.
However, the behaviour you see is described in Annex B.1.2. This section is about octal escape sequences in older ES versions, which still seems to be supported. The resulting character is defined as follows:
\x(\xx,\xxx) is only interpreted as octal sequence ifxis an octal digit, i.e. between0and7.So, all the characters
\0–\7are actually control characters. Higher values refer to other characters, for example\101isA.I cannot tell you why
alertis showing a strange character and the console does not show anything… that’s probably an implementation detail.Fun fact: Octal escape sequences are not allowed in strict mode.
Fun fact #2:
\0is actually not an octal escape sequence and will still work in strict mode, since it has its own production rule (see section 7.8.4). OTHA,\00is an octal sequence and will throw an error in strict mode.