DePaul IT 130 - JavaScript 2 (29 pages)

Previewing pages 1, 2, 3, 27, 28, 29 of 29 page document View the full content.
View Full Document

JavaScript 2



Previewing pages 1, 2, 3, 27, 28, 29 of actual document.

View the full content.
View Full Document
View Full Document

JavaScript 2

94 views


Pages:
29
School:
DePaul University
Course:
It 130 - Introductory Computing for the Web
Introductory Computing for the Web Documents

Unformatted text preview:

Javascript II Expressions and Data Types JavaScript Review programs executed by the web browser programs embedded in a web page using the script element programs consist of statements executed sequentially 2 Statements End with semi colon Cannot occupy multiple lines Assignment statement var value The value on the right can be any legal expression Function call document write foo 3 Variables A variable is a named location where a value can be stored In JavaScript Other languages using a variable creates it can also declare require that variables be declared before being used Variables have scope locations in the program where they are valid will discuss this later on 4 Variable declaration Declaration is optional in Javascript Syntax var foo Says that foo is a variable we will use later 5 Data types What is the difference between the following statements val1 53 val2 53 These values are different to JavaScript stored differently manipulated differently same operation may mean something different on strings in concatenation on numbers is addition 6 Data Type A characterization of a stored value Determines what kinds of values can be stored how the value is stored internally what operations can be applied Syntactic representation how the value is expressed in a program 7 JavaScript Types Strings Integers Floats real numbers Boolean true or false 8 Strings What values What operations lists of characters any length including the zero length null string concatenation operator output to the Web page using document write returned by prompt function Syntax double or single quotes 9 Examples val1 Hello val2 there val3 val1 val2 document write val3 val4 45 val2 val3 val5 document write val2 10 Integers What values What operations standard mathematical operations special math functions Syntax whole numbers between 9223372036854775808 and 9223372036854775808 unquoted integers Note book doesn t use integers in examples 11 Examples val1 45 val2 055 val3 val1 val2 Math sqrt val3



View Full Document

Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view JavaScript 2 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view JavaScript 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?