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(),JSONsupport.
letandconstvariables 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
exportis used for export;- keyword
importis used for import;- they can be perceived as parts of constructor from which program is assembled;
- modules are always
"use strict"-thisis 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, flatMapfor arrays;fromEntriesfor 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();