and 3booleans truefalse learn later 2 special

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: avaScript primitive types: (1)numbers : whole integers (eg. -3, 0, 104, but not "123") floating-point values (eg. week 3 tutorial3.1416, but not "12.3"), See -0.001, NaN (not a number) Infinity (2)strings of text - Textbox, innerHTML, prompt dialog's result, "...", and `...' (3)booleans (true/false) - learn later! 2 special values (not belong to any one common type): null : means no value. Example: If no element is called 'a', then d o c um e n t.g e tEle m e n tBy Id ('a ') gives null. undefined : means a variable that has been declared but never had a value assigned to it. ie. its value is still undefined. Example: va r x; a le rt(x) ; shows undefined. (CS1301) Introduction to Computer Programming City Univ of HK / Dept of CS / Helena Wong 4. Program Structure III - 10 Data Types Numbers Can also be represented as Hexadecimal values: 0x.. or 0X.., eg. var x; x=0xFF; alert(0xFF); eg. var x; x=0123; alert(0123); - set x to 255(10) [ie. 15*16+ 15] - display 255...
View Full Document

Ask a homework question - tutors are online