JavaScript π
Let's learn a single threaded, multiparadigm and just-in-time compiled language
1. Language Basics (syntax and stuff)
Type conversion and type coercion
String to Number conversion
let year = '1991'
let month = 'jan'
console.log(Number(year)) // 1991 -> Number
console.log(Number(month)) // NaN -> Not a numberconsole.log("I am " + 23 + "years old") // here 23 which is a number gets converted
//to string automatically by JS. This is type coercion
// If JS didn't have type coercion then we have to do this
console.log("I am " + String(23) + "years old") // but luckily we have type coercion
Truthy and falsy values

== vs ===

Statements vs Expressions
Conditional (Ternary) operators
Null Vs Undefined
Scoping


Not defined vs not initialized

arguments
Deep copy
2. Modern Javascript development
Modules

Modules







NPM
Parcel - Module bundler
Babel and Polyfilling
Best practices, Functional (Declarative) and Imperative Programming


Immutability is the best practice where we don't mutate the original array or object but instead copy them into a new one and then work with that. But how now to modify an object?


Vite

3. About JavaScript
History of JavaScript


Is JS pass by value or pass by reference?
4. Debouncing
Search Box
Scroll
5. Throttling
Shooting game
Google Map resize
Simple btn-click without throttling
Now we introduce a function that limits the shooting and this function is the core of throttling behavior
Generalizing this function by passing the parameters so that we can use throttle hoc for some other implementations
Passing the context from throttle hoc to fn

6. Numbers, Dates, and so on
Convert String to Number
Not a number (NaN)

Check if something is a Number or not (better than isNan())
Read a integer out of a string
Read a float out of a string
Rounding integers
Rounding decimals
7. DOM
Document Object Modal

What is Node?

Selecting document elements

Selecting elements
Add to / remove from DOM (2 ways)
1. insertAdjacentHTML(param1,param2) -

2. document.createElement(htmlElement)



Remove a DOM element



Get styles of a DOM element
Working with CSS Custom properties


HTML Attributes - Get and Set Attributes


Classes add and remove

Data Attributes

Implement Smooth scroll

Get scroll position of the page

Get the width and height of the viewport


Summary of getting element postion on page
Adding/Removing Event Listeners

Removing Event Listener ( It can't be done in 2 - onmouseenter one)
onmouseenter one)
Event-Propagation (Capturing and Bubbling)






Stopping the event propagation


Event Delegation
Without event delegation

With event delegation

DOM traversing
Going downwards - Selecting Children



Going upwards - Selecting Parents



Going sideways - Selecting Siblings


TODO Implementing Sticky Navigation
TODO Implementing Sticky NavigationWebpage lifecycle DOM Events
1. DOMContentLoaded Event - (Fired on document object)

2. Load Event - (Fired on window object)

3. Before Unload Event - (Fired on window object)

Async vs Defer script loading (Async and Defer is HTML5 feature and not the JS feature)




8. Local storage
9. Arrays
Useful array methods
Flat and FlatMap example

Sort example
Array destructuring
For Each loop vs for of loop

For each on maps

for each on set

Map, Filter, and Reduce

Reduce
find method
fill method
Ways to create Array
Array.from()
Ways to check if it's an array or not
Summary Of Array Methods

10. Objects



Useful Object methods
Object destructuring
Method Borrowing

11. Modern Operators
Spread and Rest operators (Expand and Compress)
Spread operator - ON RIGHT-HAND SIDE OF =
Rest pattern/rest operator - ON LEFT-HAND SIDE OF =
Short circuit operator (&& and ||)
||
&& (opposite to ||)
Nullish coalescing operator (??)
Optional chaining (?.)
for-of loop
for-in loop (old method- use for -of now)
12. Sets
13. Maps
Building a simple quiz app using Map
14 Summary of JS datastructures and when to use them

15. Strings in Javascript
Strings are primitives, so how does it have methods? Only objects contain methods right?
16. Regular expressions in JS π
17. Functions
Default parameters

value vs reference types inside a function

First-class functions/citizens and Higher-Order functions

Call-back functions

Let's take another example for call-back functions
Call


Apply

Bind


Polyfill bind method
A must watch video for polyfill bind
Immediately invoked functions (IIFE)

Why do we need IIFE

When to use IIFE?
Closures


Advantages of closures

1. Closures can be used for function currying

2. Closure can be used for data hiding and encapsulation
3. Closure can be used for Function once ( calling a function only once )
4. Closure can be used for memoization (to keep the time consuming computation in memory and returning it)
Disadvantages of closures
What is a garbage collector?
18 . Async Javascript
What is callback hell, & promises? Resolve CB Hell with promise chaining (.then) and async await. All this you will learn by building an ice-cream shop project.
Interview Questions on Promises and SetTimeout
Last updated
