Prime JavaScript tutorial

Basics

Introduction Running JavaScript JavaScript first program Let's analyze the program code Next examples Script files Multiple files Note Files caching Strict mode Comments Variables Using of variables Declaring of multiple variables Variable value changes Multiple let for single variable Math operations on numbers Math operations on variables Math operations precedence Equal precedence Grouping parentheses Fractions Negative numbers Plus sign before variables Division remainder Exponentiation Exponentiation precedence Strings String concatenation String length Template strings Multiline strings Special values Undefined value Null value True and false values NaN value Infinity и -Infinity Console Data type in the console Errors in the console Constants Automatic type conversion Conversion to number Short number conversion Incorrect numbers conversion Numbers extraction Conversion to string String conversion applying Boolean type conversion Conversion to boolean type String characters String immutability Last string character Strings containing digits Accessing the digits of a number Operations to change a variable Shorthand operations Increment and decrement Prefix and postfix type Inaccurate calculations Prompt function Prompt types problem Writing to document Finding mistakes practice Operations practicum Formulas practicum

Arrays

Introduction to arrays Getting elements Array length Changing elements Overwriting an array elements Increment and decrement Adding elements by keys Sparse arrays Adding elements via "push" Keys from variables Delete operator Finding mistakes practice

Objects

Introduction to objects Entire object output String keys of objects Object properties Object key restrictions Changing elements Adding elements Object disorder Array of object keys Object length Keys from variables Mistake accessing element Mistake accessing property Computed properties in operator delete operator Object typification Arrays as objects Distinguishing arrays from objects Objects and primitives Passing objects by reference Constants Programming style through constants Finding mistakes practice

Conditions

if-else construct Greater than and less than operators Checking for equality Checking for inequality Variables comparison String equality Strings and numbers equality Equality in value and type Inequality in value and type Logical AND Logical OR Precedence of logical operators Combining conditions Inverting logical expressions Conditions with boolean values Comparing values with a boolean type Shorthand checking for true Shorthand checking for false General shorthand checking Complex conditions in shortened form Optionality of else construct Optionality of curly braces Braces optionality problem else if construct Nested if-else constructs switch-case construct Break optionality Ternary operator Logical operations confirm function Scope Nuances of scope Checking parts of hour Checking the length of strings and arrays Checking the characters of a string Checking the digits of a number Checking the division remainder Finding mistakes practice Practicum

Loops

Introduction For loop For-of loop For-in loop While loop For-loop for arrays Conditions in loops Accumulation of numbers Accumulation of array elements String formation Digits of a number break statement continue statement Nested loops Scope Nested loops and scope Filling an array Changing an array Filling objects Changing objects Working with flags Coding tips Code debugging tips Finding mistakes practice Practicum

Multidimensionality

Multidimensional arrays Three-dimensional array Arbitrary arrays Iterating over multidimensional arrays Iterating through the ordinary for Filling multidimensional arrays Issues of filling multidimensional arrays Filling multidimensional arrays in order Multidimensional objects Iterating over multidimensional objects Multidimensional structures Iterating over multidimensional structures Array of objects Keys from variables Adding elements to arrays Adding elements to objects

Standard methods

Powers Rounding functions Extremum Random Modules Character case String cutting String searching String replacing String parts Boundary elements Array cutting Array searching Object keys Mistakes

User-defined functions

Introduction Function parameters Multiple parameters Parameters-variables Optional parameters Return statement Sequential function call Return nuance Loop and return Usage of return in loops Return trick Flags in functions Logical operators in functions Function advices Finding mistakes practice Functions practicum

Function variables

Global variables Local variables Variables names coincidence Changing global variables Global variables and function parameters Variable and parameter names coincidence Parameter-object

Types of Function Declarations

Source code of function and result Function as variable Function to variable Assigning functions to variables Function and variable same name Declaration types Difference between declarations Semicolon for declaring functions Nuances of Function expressions Function has name, but is Function Expression Named function expressions How to check the type of a function Left expression Right expression Array with functions Object with functions Application of object with functions

Nested functions

Passing functions as parameters Named functions parameters Parameters of passed functions Pass a number as a parameter Passing functions applying Inner functions Inner functions scope Parameters of outer function Outer and inner functions parameters Same name parameters Function returning a function Any nesting level Returning function parameters Callback functions Nuances Arrow functions Arrow functions applying

Closures

Outer variables access Lexical environment of functions Lexical environment applying Intro in closures Counter using closure Nuance local variable Nuance global variable

IIFE

Intro Assignment function to a variable Applying Round brackets Parameters Multiple calling Pitfalls Semicolon for safety Closures and IIFE

Recursion

Intro Example with a parameter Sum of array elements with recursion Multidimensional structures Sum of array elements Manipulations with elements

Iteration methods

Map method ForEach method Filter method Every method Some method Find method Reduce method

Spread operator

Spread operator More advanced examples Extreme array values Spread operator and array merging Spread operator for strings Spread operator and numbers

Rest operator

Rest operator Digits sum Arrays into two dimensional Arrays into one

Destructuring

Array destructuring Array from a function Skipping array elements Extra array values Rest of an array Default values for arrays Default functions for arrays Variable declaration for arrays Object destructuring Variable names for objects Default values for objects Default variables and values for objects Declaring variables for objects Function parameters Objects in function parameters destructuring

Time

Working with the Date object Date formats Changing a date format Getting the day of the week Outputting a date with words Time setting Timestamp format Timestamp difference Difference of objects with date Automatic date adjustment Finding the last day of the month Leap year determination Date validation Day of the current year Day of the current month Day of next or previous year Day of next or previous month Difference of points in time Point in time of day Beginning of the day End of the day Loop check of time Practice in getting points in time String comparison of dates Comparison of date without year Date falling into the interval Comparing objects with dates

Introduction to the DOM

Introduction DOM elements Getting a DOM element Advanced selectors of the DOM element Attaching handlers Named event handlers Single handler for elements Handlers for one event Handlers for different events Element text HTML code of element Tag attributes as properties Working with text fields Text fields focus Attribute-exceptions Methods and properties chains Advantages and disadvantages of chains This object This advantage Getting a group of elements Named handlers in a loop Anonymous handlers in a loop Unbinding event handlers Unbinding handlers in a loop Unbinding anonymous handlers Coding tips Finding mistakes practice Practicum

Attributes

Attributes getting method Attributes setting method Attributes removing method Attributes checking method Custom attributes Custom hyphenated names Data methods CSS classes array CSS classes adding CSS classes removing CSS classes checking CSS classes toggling

Stylization

Style attribute Hyphenated properties Exception CSS classes CSS classes advantages Applying

Searching

Elements descendants Elements parents All parents Siblings Searching by id Searching by tag Searching by class Searching insideelement

Nodes

Intro Loop iteration of nodes Node name Node type Node text

Forms

Working with textarea Element disabling Working with checkboxes Alternating attributes without values Working with radio buttons Change event Input event Focus and blur methods

Dropdown lists

Working with dropdown lists Value attribute of dropdown lists Changing the selected list item Number of the selected list item Getting dropdown list items Items as array Options Selecting a list item Getting the selected option

Event object

Event object basics Event coordinates Event type Event element Getting pressed keys Modifier key tracking Canceling default action Event bubbling Target element when bubbling Stopping event bubbling Multiple handlers on an element Immediate termination of bubbling Usage of stopping event bubbling Events capturing Handlers for new elements Event delegation Universal event delegation

Context

Context basics Unbound function context Context losing Solving the context problem Variable solution Passing parameter-solution Arrow function solution Call method Call method with parameters Apply method Bind method

Timers

Timer start Сounter using a timer Stopping a timer Buttons to start Multiple launch Buttons to stop Working with the DOM Timers and context loss Timers and the DOM practicum Delay before execution Timer with Delay

Element manipulation

Creating and inserting elements Binding events on insertion Creating elements in a loop Attaching handlers in a loop Removing elements Insertion on edges Insertion before Adjacent insertion Adjacent tag insertion Cloning elements Checking elements

Practicum

Creating elements from an array Creating ul lists in practice Creating HTML tables Sequential populating an HTML table Creating a table from an array Creating a table from an array of objects Adding rows and columns to a table Modifying table cells Removing new items Link to remove an element Creating links to remove Editing a single element Hiding text while editing Editing in a group of elements Simultaneous editing and removal Element styling Buttons to hide and show an element Many elements with show buttons Element activation Alternation of activation styles Changing elements in practice

Functions an the DOM

Functions for working with a DOM element Functions for working with a group of elements Passing a callback to work with the DOM Passing an index number to a callback Passing an element as a function parameter Passing a group of elements as parameters Function for creating HTML tables Returning a table from a function Function to create a table from an array

Modules via closures

Variables conflicts Modules via closures Practical usage Passing parameters Passing a parent element Passing module settings Default parameters Exporting variables and functions Object export in modules via closures Libraries via closures
enru