jschap03 - Chapter 3: Data Types and Operators JavaScript -...

Info iconThis preview shows pages 1–18. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 3: Data Types and Operators JavaScript - Introductory
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Tutorial3Calculator.html
Background image of page 2
Section A: Using Data Types and Arrays
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Objectives In this section, students will learn: How to use data types About numeric data types About Boolean values How to use strings How to use arrays
Background image of page 4
Data Types Data type is the specific category of information that a variable contains Data types that can be assigned only a single value are called primitive types JavaScript supports five primitive data types: Integer numbers Floating-point numbers Boolean values Strings Null value
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Primitive Types
Background image of page 6
Data Types Programming languages that require you to declare the data types of variables are called strongly-typed programming languages Strong typing is also known as static typing Programming languages that do not require you to declare the data types of variables are called loosely-typed programming languages Loose typing is also known as dynamic typing since data types change after being declared
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Values Returned by Typeof () Operator
Background image of page 8
PrintDataTypes.html
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Numeric Data Types An integer is a positive or negative number with no decimal places Integer values in JavaScript can range from -90071992654740992(-2 53 ) to 9007199254740992 (2 53 ) A floating-point number contains decimal places or is written using exponential notation
Background image of page 10
Numeric Data Types Exponential notation , or scientific notation , is a way of writing very large numbers or numbers with many decimal places using shortened format Floating-point values that exceed the largest positive value of + 1.7976931348623157 x 10 308 result in a special value of Infinity
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Boolean Values A Boolean value is a logical value of true or false You can also think of a Boolean value as being yes or no , or on or off . Boolean values are most often used for decision making and comparing data Only the words true and false can be used to indicate Boolean values Boolean values get their name from the 19th century mathematician George Boole
Background image of page 12
Program That Returns a Boolean Value to an Event Handler
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
LiteralStrings Program
Background image of page 14
Strings A text string contains zero or more characters surrounded by double or single quotation marks There is no special data type in JavaScript for a single character, such as the char data type in the C, C++, and Java programming languages Take extra care when using single quotations with possessives and contractions in strings JavaScript interpreter always looks for the first closing single or double quotation mark to match an opening single or double quotation mark
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Output of LiteralStrings Program in a Web Browser
Background image of page 16
Strings An escape character tells the compiler or interpreter that the character that follows it has a
Background image of page 17

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 18
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 61

jschap03 - Chapter 3: Data Types and Operators JavaScript -...

This preview shows document pages 1 - 18. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online