. A string is a type of variable that stores a string (chain of characters). To make a new string, you can make a variable and give it a value of new String(). var foo = new String(); But, most developers skip that part and use a string literal: var foo = my string; After you have made your string..
So, the test if ( ~str.indexOf("...") ) is truthy only if the result of indexOf is not -1. In other words, when there is a match.But 2 bytes only allow 65536 combinations and that’s not enough for every possible symbol. So rare symbols are encoded with a pair of 2-byte characters called “a surrogate pair”.
// different case letters have different codes alert( "z".codePointAt(0) ); // 122 alert( "Z".codePointAt(0) ); // 90 String.fromCodePoint(code) Creates a character by its numeric code. There is no separate type for a single character. The internal format for strings is always UTF-16, it is not tied to the page encoding