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

Info icon This 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
Image of page 1

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

View Full Document Right Arrow Icon
Tutorial3Calculator.html
Image of page 2
Section A: Using Data Types and Arrays
Image of page 3

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

View Full Document Right 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
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
Image of page 5

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

View Full Document Right Arrow Icon
Primitive Types
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
Image of page 7

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

View Full Document Right Arrow Icon
Values Returned by Typeof () Operator
Image of page 8
PrintDataTypes.html
Image of page 9

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

View Full Document Right 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
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
Image of page 11

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

View Full Document Right 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
Image of page 12
Program That Returns a Boolean Value to an Event Handler
Image of page 13

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

View Full Document Right Arrow Icon
LiteralStrings Program
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
Image of page 15

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

View Full Document Right Arrow Icon
Output of LiteralStrings Program in a Web Browser
Image of page 16
Strings An escape character tells the compiler or interpreter that the character that follows it has a special purpose
Image of page 17

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern