JS - Udemy Flashcards
ES6 def & features
Var, arrow functions?
How to get to & run code in console?
- Control+Shift+C or Inspect or More Tools; -
What is modulo? + ex
- %, returns remainder; - 25 % 5 = 0
How to notate exponents?
5**2 returns 25
What is the order of operations?
PEMDAS - parentheses, exponents, mult, div, add, sub
What is NaN & what will return it?
0/0; NaN + a number;
How does the browser read JS?
- HTML file, include
Quick way to view .js in browser?
- Open html file in file explorer that contains .js tag
What’s an Unary Operator? Ex.
- ++ (existingVar+=1); – (existingVar-=1);
What are the primitive types?:
- Number, String, Boolean, Null, Undefined
Booleans
- true & false; - 1 or 0
What does null mean?
- Absence of any value
What does Undefined mean?
- Variable with no assigned value
List the falsey values
false, 0, “”, null, undefined, NaN
How to get the index (content) of a string/letter? ex.
string[1] = t
How to convert a string to upper? ex
string.toUpperCase( )
How to convert a string to lower? ex
string.toLowerCase( )
What does Trim do? ex.
” string “.trim = “string”
How to get the index (letter) of a string? ex
string.indexOf(“tr”) = 1
How to return a fragment of a string? ex
string.slice(0,2) = “str”
How to substitute part of a string? ex
string.replace(‘g’, ‘z’) = “strinz”
How to keep a quote or backslash in a string from fucking up your day? ex
- Escape Characters; - / preceding a “ or ‘ or /