Fichas
JS Misc.
Fichas del conjunto (66)
- 1API - DefinitionApplication Programming Interfaces
- 2Browser APIs - DefinitionBuilt into your browser. Able to expose data from surrounding computer environment
- 3Third Party APIs - DefinitionNot built into the browser, you generally have to find + download the code
- 4JS : Interpreted or Compiled?Interpreted
- 5Async Attribute- Scripts will download without blocking the render of the page
- If multiple scripts, no guarantee that they will download in a certain order - 6Defer Attribute- Scripts will run after the page is rendered
- If multiple scripts, they will download in the order that they are listed (in the head)78 - 7Assignment Operators - Layman - ExamplesOperators that assign value to the left operand based on the value of right operand
= , +=, -=, *=, /= - 8Declaring a variableex: var myDog;
- 9Initializing a variable(after declaration)
myDog = 'Scott'; - 10Types of Numbers: Floats or Floating Point NumbersDecimal Numbers
ex: 2.792 - 11Dynamically Typed LanguageYou don't need to specify what data type a variable will contain
- 12Types of Numbers: DoublesSpecific type of floats that have more decimal numbers + more accuracy
- 13OperandsNumbers involved in sums
- 14Common Arithmetic Operators+
-
*
/ - 15Increment/Decrement Operators++
-- - 16Comparison Operators===
!==
<
<= - 17str.substring( a, b );- Returns the part of the string BETWEEN the indexes (or the end of the string)
- A: the index of the starting character
- B: OP, the index of the ending character - 18str.slice( a, b)- Extracts a part of a string and returns it as a new string, without changing the original
- A: OP, The start index of the 'cut'. If negative, treated as 'string.length + (-a)'
- B: OP, The end index right before the 'cut'. This will not be included. If negative, treated as 'string.length + (-b)' - 19str.repeat( a )- Returns a new string of the called-on string repeated 'a' times, concatenated together
- A: Number of repetitions - 20str.charAt( a )- Returns the character at the specified index position
- A: Positon - 21str.split( a, b )- Breaks the called-on string into an array of strings (separated by 'a'), and returns it as a new array
-A: OP, Where the separations will occur . Using an empty string (ie: "") will cause problems.
- B: OP, The limit. Limits the amount of separations that will occur. - 22str.endsWith( a, b );- Returns true/false if the called-on string ends with 'a'
- A: The string/chars to be matched
- B: OP. If provided it is used as the length of string - 23String Literals- Strings between quote marks
- ex: 'This is my string literal' - 24How to escape characters in JS- Use a backslash before the character
- ' \ ' - 25str.charAt(*); Another way to write the above statementstr[ * ];
Another way to write the above statement - 26str.indexOf( a, b )Returns the index of the called-on string where 'a' first appears. If 'a' is not found, returns -1
- A: String to match
- B: OP, the index # to start the search from - 27str.toLowerCase()- Returns a new string of the called-on string's characters, all lowercase
- 28str.toUpperCase()- Returns a new string of the called on string's characters, all uppercase
- 29str.includes( a, b )- Returns true/false if the called-on string contains 'a'
- A: The string to check
- B: OP, Position. The start index for the search - 30An example of ' list-like objects 'Arrays
(example of llo) - 31if ( myVar ) { ... } - Values of ' myVar ' that will return false (not run the block)false
undefined
null
0
NaN
' ' (empty string) - 32str.startsWith( a, b )Returns true if the called on string begins with 'a'
A: The string to match
B: OP, position from where to start the search - 33str.endsWith( a, b )Returns true of the called on string ends with 'a'
A: The string to match
B: OP, Length. Used as the length of the called on string - 34str.trim()Removes whitespace from both beginning and end of a string
Return: A new string with no whitespace on either end - 35arr.slice( a, b )Returns a new array populated from indexes 'a' to 'b' (b not included) of the called-on array
A: Index Start. @
B: OP, index end (not included). @ - 36arr.reverse()Reverses an array; first index becomes last index
Return: The reversed array (no copy) - 37For loop - Initializer - aka - Laymansaka: Counter Variable
- Generally a variable set to a number - 38For Loop - Exit ConditionDescribes when the loop should stop looping
- 39For Loop - Final Expression- Generally used to increment/decrement the iteration variable
- 40break; (in a loop) - ResultThe loop is exited and whatever code is directly after it will be run
- 41continue (in loop) - ResultSkip to the next iteration of a loop
- 42while loop - syntaxinitializer;
while (exit condition) {
//code
final expression;
} - 43do/while - syntaxinitializer;
do {
//code
final expression;
} while (exit condition) - 44arr.includes( a, b )- Returns true/false if the called-on array contains element 'a'
A: The element to search for
B: OP, Start Index. A negative value searches from the end. - 45arr.sort( a )Sorts the called-on array (by string unicode points) and returns the modified array (no copy)
A: OP, A function the defines the sort order - 46arr.fill( a, b, c )Fills an array from a start index to an end index with a static value
A: The value to fill the array
B: OP, Start index
C: OP, End index
Return: The modified array - 47arr.pop()Removes the last element of an array
Return: The removed element, or undefined if the array is empty - 48arr.push ( a...n )- Adds one or more elements to the end of an array
A...N: The element(s) to add
Return: The new length of the array - 49arr.shift()- Removes the first element in the array
- Return: The removed element. und if empty. - 50arr.unshift( a...n )Adds one or more elements to the beginning of an array
- A...N: The element(s) to be added
- Return: The new length of the array - 51Math.abs( a )- Returns the absolute value of a number
- A: A number - 52Math.pow( a, b )- Returns 'a' ^ 'b'
- A: Base #
-B: Exponent - 53Function Invocation OperatorThe parentheses after a function
- myFunction' () ' ; - 54If intending to pass arguments into a named function that is assigned to an event handler, why do you need to put that named function into an anonymous function?If you add ' () ' to a function, it is immediately run, thus the lack of ' () ' when using EH's. But, to pass in arguments, you need ' () '. So, put the function into an anonymous function, so it is no longer in the immediate (global) scope, and thus not called immediately.
- 55Web Events - Part of the core JS Language?No. They are part of the JS APIs built into the browser
- 562 advantages of using addEventListener() over onclick1. You can use removeEventListener() to keep code clean
2. You can add multiple event listeners to a single element event - 57Event Handlers vs. Event Listeners-Often used interchangeably, but strictly speaking...
- Handlers: blocks of code run in response to an event.
Listeners: Listen for the even to happen. - 58Event Handler Properties- Properties of the Event object
- ex: onclick, onmouseover, onload, onfocus, etc
- ex: btn.onclick = myFunction; - 59DOM Level 2 Events- ex: addEventListener()
- I believe these are sometimes called event listeners, though technically that term differs + is not specific to them. - 60Event Capturing - Order- Outer most ancestor first, then moves down the decedents till it reaches the triggered element
- 61Event Bubbling - Order- Acts on the triggered element, then moves up the tree to the root element.
- In modern browsers, all events are handled by the bubbling phase (not capturing) - 62music.genre.blues; Convert to bracket notationmusic [ 'genre' ] [ 'blue' ];
Convert to dot notation - 63The 'this' keyword, at least as it relates to objectsRefers to the current object the code is being written inside.
- 64What is instantiation?Creating an instance of an object from a class
- 65A better way of access an objects' prototype than: obj.__proto__;Objects.getPrototypeOf( obj );
- 66Define ParsingConverting a string to a native object
Información
- Descripción
- Fichas sobre JS Misc., creado por Cosmo Brown el 04/10/2018.
- Creado por
- Cosmo Brown
- Visitas
- 0
- Valoración