Is there any built-in way to "detect" invalid strings?
Here's an example:
// this is an invalid unicode code point
const bad = "\udc11"
// but i can console.log it:
console.log(bad)
// prints: �
// and i can use it in other strings:
const foo = bad + "-" + bad
// but when i try to evaluate it in the repl:
> badAndPrefixed
Unterminated string literal Unknown exception
Some questions:
- Can I somehow detect "bad" Unicode strings?
- Why can I console.log it, and what does it do?
- What happens in the Deno REPL that makes it throw an error?