• All commonly used characters are 2-byte code

  • The backslash

    console.log(``) // ''
  • String method

    S [I] => s.harat (I) // locate s.indexof (STR,index) // start from index look for STR s.lastindexof (STR,index) // start from index look for STR s.lastindexof (STR,index S.includes (STR,index) // Start with indx to find if s contains STR. StartsWith (STR) // Start with s. StdsWith (STR) // Get substring S.slice (start,end) // does not include end. It could be negative. S.slice () is equivalent to copying s s.substring(start,end) // without end. Negative = 0. Allow start>end to automatically change position s.substr(start,length) // start a string with length from start. // Returns the UTF-16 encoding in s at the index position => s.HardeAt (index) string.fromCodePoint (num) // Returns the number represented by UTF-16 encoding => string.fromCharCode (num) s1.localeCompare(s2) // Returns a num indicating whether s1 is before s2 // other s.rim () // Removes the space before and after s S.repeat (num) // Repeat the string num times
  • Bit by bit NOT ~ : It converts a number to a 32-bit integer (deletes the fractional part if it exists), and then reverses all the bits in its binary representation.

    ~n = -(n+1)