javascript variables and data types. output without alert or form console.log();
DESCRIPTION
Holding informationTRANSCRIPT
![Page 1: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/1.jpg)
JavaScriptVARIABLES AND DATA TYPES
![Page 2: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/2.jpg)
OUTPUT WITHOUT ALERT OR FORM
CONSOLE.LOG();
![Page 3: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/3.jpg)
Holding information
![Page 4: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/4.jpg)
example
A = B + C;
Cubby Hole 2: add this value
Cubby Hole 1: take this value
Cubby Hole 3: place it here
![Page 5: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/5.jpg)
Defining CUBBY HOLESThey are called variables
Define them Give them values Take values from them
![Page 6: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/6.jpg)
= means “takes the value of”A takes the value of B+C
![Page 7: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/7.jpg)
VALUES
![Page 8: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/8.jpg)
What values can it take?
Any “expression” What is an expression?
Variables Constants Operators functions
Different for numbers and strings
![Page 9: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/9.jpg)
Numbers
Regular math operators Variables Constants Functions (random, floor)
![Page 10: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/10.jpg)
Strings
Think of Scrabble tiles Each tile is a
Letter Number Punctuation mark Space (blank)
![Page 11: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/11.jpg)
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
![Page 12: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/12.jpg)
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”
![Page 13: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/13.jpg)
SubstringA substring is also a StringA 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
![Page 14: JavaScript VARIABLES AND DATA TYPES. OUTPUT WITHOUT ALERT OR FORM CONSOLE.LOG();](https://reader036.vdocuments.site/reader036/viewer/2022062223/5a4d1b0c7f8b9ab05998b585/html5/thumbnails/14.jpg)
Referencing characters Each character has a position
Note that it starts at 0, not 1
H I M O M0 1 2 3 4 5