JavaScript Programmer’s Reference Example code: // Demonstrate bit (Frontpage web hosting)

JavaScript Programmer’s Reference Example code: // Demonstrate bit inversion to change character case myString = “AbCdEfGh”; myLength = myString.length; document.write(”Original source string : “); document.write(myString); document.write(”
“); document.write(”
“); document.write(”

“); for(myEnum = 0; myEnum < myLength; myEnum++) { myChar = myString.charAt(myEnum); myCharCode = myString.charCodeAt(myEnum); myNewCharCode = myCharCode ^ 32; document.write("“); } document.write(”
“); document.write(”Orig char“); document.write(”Char code“); document.write(”Bit inverted
char code
“); document.write(”New char
“); document.write(myChar); document.write(”“); document.write(myCharCode); document.write(”“); document.write(myNewCharCode); document.write(”“); document.write(String.fromCharCode(myNewCharCode)); document.write(”
“); See also: Bit-field, String.toLocaleLowerCase(), String.toLocaleUpperCase(), String.toLowerCase(), String.toUpperCase() Bit-field (Definition) A collection of binary digits. Although JavaScript does not support bit-fields, you can perform many binary operations on patterns of bits by using the bitwise operators and various simple mathematical expressions to simulate other bit manipulation operators that are not provided as part of the standard. Op Description ~ Bitwise complement (NOT) & Bitwise AND << Bitwise left shift >> Bitwise right shift >>> Bitwise right shift (unsigned)

Leave a Reply