HTML and CSS Reference
In-Depth Information
EXPLANATION
1
The user is prompted for input. The value he or she enters in the prompt box is
assigned to the variable age . (See Figure 5.17.)
2
If the value of age is greater than 55, the value to the right of the ? is assigned to
the variable price ; if not, the value after the : is assigned to the variable price .
3
The alert dialog box displays the value of the variable price . (See Figure 5.18.)
Figure 5.17 The user enters 12 . This value is assigned to the variable age in the
program.
Figure 5.18 Because the age is not greater than 55 , the price is assigned 7.50 .
5.2.8 Bitwise Operators
Most of us represent numbers in decimal base 10, a number system based on 10 values
starting from 0 to 9; such as $50.00 or 2011. The HTML color codes are represented in
hexadecimal, base 16, which uses 16 distinct symbols: 0-9 and A-F. The color cyan is
#00FFFF and fuschia is #FF00FF. Computers store data in binary, base 2, two values
either 0 or 1, called bits. A byte is made up of 8 bits, a word is two bytes, or 16 bits, and
two words together are called a double word or dword, which is a 32-bit value. Today,
64-bit processors have become the standard for most modern systems. Because the pro-
cessor uses binary numbers, when performing low-level programming, such as writing
device drivers, graphics, and data compression, bitwise operations are necessary, tasks
that are more suitable to languages like C or Java.
“Bitwise operators treat their operands as a set of 32 bits (zeros and ones), rather
than as decimal, hexadecimal, or octal numbers. For example, the decimal number
nine has a binary representation of 1001. Bitwise operators perform their operations
on such binary representations, but they return standard JavaScript numeric values.”
 
 
Search WWH ::




Custom Search