Presentation is loading. Please wait.

Presentation is loading. Please wait.

JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();

Similar presentations


Presentation on theme: "JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();"— Presentation transcript:

1 JavaScript VARIABLES AND DATA TYPES

2 OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();

3 Holding information

4 example A = B + C; Cubby Hole 2: add this value Cubby Hole 1: take this value Cubby Hole 3: place it here

5 Defining CUBBY HOLES  They are called variables  Define them  Give them values  Take values from them

6 = means “takes the value of” A takes the value of B+C

7 VALUES

8 What values can it take?  Any “expression”  What is an expression?  Variables  Constants  Operators  functions  Different for numbers and strings

9 Numbers  Regular math operators  Variables  Constants  Functions (random, floor)

10 Strings  Think of Scrabble tiles  Each tile is a  Letter  Number  Punctuation mark  Space (blank)

11 What is a String?  A literal string must be inside double quotes or single quotes  “this is a string” and this is not a string.  Remember to beware cut and paste

12 Concatenating (formally)  It means combining two or more things into one thing  + Anything can be concatenated  “awe” & “some” = “awesome”  Whitespace only matters inside quotes  “a”+“b” same as “a” = “b”  “a ” + “b” NOT the same as “a” + “b”

13 Substring  A substring is also a String  A substring is a part of another string  “cake” is a substring of “birthday cake”  so are “day”, “thd”, and “y cake”  “they” is not, neither is “hello” or “dude”  Will come back to how to extract substrings

14 Referencing characters Each character has a position Note that it starts at 0, not 1 HIMOM 012345


Download ppt "JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();"

Similar presentations


Ads by Google