Notas
ELOQUENT JAVASCRIPT
Conteúdo das notas (1)
Página 1
VALUES, TYPES, AND OPERATORS
- everything inside a computer is data
- data can be read, modified, created
- data is stored as sequences of bits
- bits are two valued things (0 and 1)
- pieces of data are values
- values are created by invoking their names
- values are stored in bindings
- every value has a data type
- values can convert to another data type, either on their own (coercion) or by applying a method
data type: NUMBER
- numeric value
- integer or fractional
- used for artimetic operations: addition, substraction, divisions, multiplication, remainder
- special numbers Infinity, -Infinity, NaN
- NaN is never equal to itself
- null (nothing)
data type: STRING
- text in quotes
- escaping characters: - \\ backslash
- \n new line
- \t tab
- \' single quote
- \" double quote
- concatenation: adding multiple strings into one
- template literals: in backticks
- ${ } inside template literal will compute value, convert it to string and add at that place
data type: BOOLEAN
- true or false
data type: UNDEFINED
- unassigned value
OPERATORS
- unary: - typeof, minus (marking value as negative)
- binary: - arithmetic
- comparison
- logical, except conditional
- ternary: - conditional
PROGRAM STRUCTURE
- expression is a fragment of code, that produces a value
- bindings hold values
- bindings are declared through statements
- program is a list of statements
- statements can be groupped into a single statement using { }
- single let statement may define multiple bindings
- const stands for constant binding
- collection of bindings and their values is enviroment
data type: FUNCTION
- piece of program wrapped in a value
- browsers have some build-in functions
- prompt, alert, confirm, console.log
- calling means executing a function
- functions can produce (return) values or cause side effects
CONTROL FLOW
- statements are executed from top to bottom
- this flow can be changed with conditional statements, switch statement and loop
WHILE LOOP
initialize counter; while (condition) {code; update counter;}
DO.. WHILE LOOP
initialize counter; do {code; update counter;} while (condition);
FOR LOOP
for (initialize counter; condition; update counter) {code}
Informações
- Descrição
- Notas sobre ELOQUENT JAVASCRIPT, criado por Rachel Rohac em 10-02-2018.
- Criado por
- Rachel Rohac
- Visualizações
- 0
- Avaliação