topic 🦧 a basic set of JavaScript knowledge
- 📖 Variables:
► declaration ► assignment ► var ► let & const ► naming - 📖 Data types:
► strings ► numbers ► booleans ► null ► undefined ► objects ► symbols ► BigInt - 📖 Variable scope
► global ► local ► function ► code block - 📖 Additionally:
► hoisting ► Lexical scope - 📖 Operators:
► arithmetic ► comparison ► logical ► bitwise - 📖 Literals:
► string ► numeric ► boolean ► object
- 📖 Conditionals:
► if/else ► switch ► ternary operator - 📖 Loops:
► for ► while ► do..while - 📖 Controls:
► break ► continue ► return - 📖 Exception handling:
► try..catch ► throw ► finally
console.log( object [, object, ...] );
>> Prints a message to the Console.console.dir( {object} );
>> Prints a JSON representation of the specified object.console.dirxml( document );
>> Prints an XML representation of the descendants of node.console.group( 'label' );
>> Visually groups messages together.console.info( 'log-1' );
console.info( 'log-n' );
console.groupEnd( 'label' );
console.count( [label] );
>> Writes the number of times that count() has been invoked with the same label.console.table( array [, columns] );
>> Logs an array of objects as a table.console.warn( object [, object, ...] );
>> Prints a warning to the Console.console.assert( expression, {object} );
>> Writes an error to the console when expression evaluates to false.console.error( object [, object, ...] );
>> Prints object to the Console, formats it as an error, and includes a stack trace.console.clear();
>> Clears the console.
- 📖 Basics:
► declaration ► initialization ► accessing - 📖 Methods that do not change initial array
- array search methods
- ► .indexOf ► .lastIndexOf ► .find ► .findIndex
- ► .includes ► .some ► .every
- array conversion methods
- ► .toString ► .join
- ► .concat ► .toLocaleString
- array iteration methods
- ► .map ► .reduce ► .reduceRight ► .filter
- array transformation methods
- ► ► .slice ► .flat ► .flatMap
- array search methods
- 📖 Methods that change initial array:
- array mutator methods
- ► .push ► .unshift ► .pop ► .shift
- ► .splice ► .copyWithin ► .fill
- array sorting methods
- ► .reverse ► .sort
- array mutator methods
- 📖 Other methods:
- ► Array.isArray
- ► .forEach
- 📖 Destructuring:\
- ► syntax ► swapping var
- How to copy an array?
- 📖 Basics:
► obj literals ► constructor func ► classes ► this ► prototype chain ► destructuring - 📖 Properties:
► access ► assignment ► descriptors ► computed prop - 📖 Methods:
► definitions ► this keyword ► chaining - 📖 "Collection" objects
► Map ► Set - OOP object oriented programming in JS
- 📖 Inheritance:
► patterns ► obj composition - 📖 Encapsulation:
► getters & setters ► private variables ► closure func - 📖 Polymorphism:
► overriding ► overloading ► dynamic dispatch
- 📖 Inheritance:
That is set of rules and guidelines that language must follow in order to be considered compliant with this specification.
- Strict mode (
'use strict'
) provides more detailed error checking in code and facilitates debugging.
- you cannot use variables without a declaration;
- function parameters cannot have the same names;
- this will not reference a global object by default;
- does not allow using the with construction in the code;
- cleans up variables created with eval;
Object.keys()
,filter()
,map()
,reduce()
,JSON
support.
let
andconst
variables appeared, replacing outdatedvar
;- arrow functions that preserve context;
- syntactic sugar in the form of classes;
- default function arguments;
- promises;
- destruction of objects;
- ES-modules
- keyword
export
is used for export;- keyword
import
is used for import;- they can be perceived as parts of constructor from which program is assembled;
- modules are always
"use strict"
-this
is not window, but undefined.
- destruction of arrays;
includes
;- exponentiation through
**
;
- Object.values,
- Object.entries;
- async/await;
- finally for promises;
- update in regular expressions;
- spread operator for objects;
flat, flatMap
for arrays;fromEntries
for objects;queueMicrotask()
for event-loop
- BigInt;
- Globalthis;
??
;
- 📖 Basics:
► declaration ► expression ► arrow func ► anonymous func - 📖 Parameters @ Arguments:
► positional ► default ► rest
► arg object ► destructuring ► spreading arg - 📖 Return:
► statement ► values ► implicit - 📖 Recursion:
► recursive func ► base cases - 📖 Closure:
► lexical scope ► closure func - 📖 Callbacks:
► higher-order func ► callback func
- 📖 Event loop:
- call stack
► any function that's called synchronously - microtasks
► process.nextTick ► Promise.then ► async function - macrotasks
► setTimeout(c, 0) ► setImmediate ► setTimeout(c, n) ► setInterval
- call stack
- 📖 Promises:
► syntax ► chaining ► promise.all ► error handling - 📖 Async/await:
► syntax ► error handling ► async generators
- 📖 DOM-BOM
► DOM manipulation ► Web Storage ► events - 📖 Web API
► XMLHttpRequest ► fetch API - 📖 Web Workers
►
► regExp syntax ► literals ► constructor
- 📖 RegExp methods:
► test() ► match() ► search() ► replace() ► split() ► exec() - 📖 RegExp patterns:
► char classes ► quantifiers ► alternation ► grouping ► flags - 📖 Meta-characters:
► dot, caret, dollar ► brackets
In JavaScript, all instructions can be divided into several categories:
- declaration of values
let and const never go out of scope where they were defined and are always initialized where specified;
- management of execution flow
if (condition) { "perform certain actions"; } else { "an alternative scenario takes place"; } switch (expression) { case value1: statement1 break; case value2: statement2 break; default: statements }
- iterations
while (condition) { statement }; do { statement } while (condition); for (initialization; condition; afterthought) { statement };
- functions
- others ( debugger, import, export );
There are 4 ways to execute something in JS:
- by calling the function;
- by calling the method of the object (the function is stored in the object);
- through the constructor function (create new objects of the same type);
- indirect function call via .call() or .apply();