Crisp Notes On JavaScript
Crisp Notes On JavaScript
On JavaScript
JavaScript Essentials: Quick Reference Guide! 🚀💡
Jimmy Ramani
@jimmyramani
Index
Topics Page
Why you should learn JS ? 01
let , const , var 02
Operators 05
Data Types 10
Strings 12
Events 13
Event Listener & Event Handler 14
Functions 16
Objects 18
Jimmy Ramani
@jimmyramani
Index
Topics Page
Arrays 19
Getter & Setter 20
For Loop 21
For in - For of Loop 21 / 22
While Loop 22
Do While Loop 22
Type Conversion 23
Callbacks 26
Promises 27
Jimmy Ramani
@jimmyramani
Index
Topics Page
Async - Await 28
Clousers 29
Timers 30
Proto-Typing 31
Generators 32
UniCode 33
Inheritance 34
Regular Expression (RegEx) 35
Projects Idea 36
Jimmy Ramani
@jimmyramani
1
Why you should learn
JavaScript ?
Easy to Learn
A very beginner friendly languages in which you don’t need to learn
deal with complexities.
Jimmy Ramani
@jimmyramani
2
Let , Const & Var
Let :
Variables declared with let are block-scoped. They are confined
to the block (curly braces) in which they are defined.
They are also hoisted, but not initialized, so you cannot use them
before they are declared.
let variables can be updated but not re-declared within their
scope.
Example :
Jimmy Ramani
@jimmyramani
3
Let , Const & Var
Const :
Variables declared with const are block-scoped and cannot be
reassigned after they are initialized.
Like let, const variables are hoisted but not initialized.
const is commonly used for values that should remain constant
throughout the program.
If the value being assigned is an object or an array, the variable
itself cannot be reassigned to a new object or array, but the
properties or elements of the object or array can be modified.
Example :
Jimmy Ramani
@jimmyramani
4
Let , Const & Var
Var :
Variables declared with var are function-scoped or globally
scoped, but they are not block-scoped.
They are hoisted to the top of their scope during execution, which
means you can use a variable before it's declared (though its
value will be undefined).
var variables can be re-declared and updated within their scope.
Since var doesn't have block scope, it can lead to unintended
issues when used in loops and conditionals.
Example :
Jimmy Ramani
@jimmyramani
5
Operators
Arithmetic Operators :
Perform mathematical calculations on numbers.
Examples: + (addition), - (subtraction), * (multiplication), /
(division), % (modulus), ** (exponentiation).
Example :
Comparison Operators :
Compare two values and return a boolean result.
Examples: == (equal to), != (not equal to), === (strictly equal to),
!== (strictly not equal to), < (less than), > (greater than), <= (less
than or equal to), >= (greater than or equal to).
Example :
Jimmy Ramani
@jimmyramani
6
Operators
Logical Operators :
Perform logical operations on boolean values.
Examples: && (logical AND), || (logical OR), ! (logical NOT).
Example :
Assignment Operators :
Assign values to variables.
Examples: = (assignment), += (addition assignment), -=
(subtraction assignment), *= (multiplication assignment), /=
(division assignment), %= (modulus assignment).
Example :
Jimmy Ramani
@jimmyramani
7
Operators
Unary Operators :
Operate on a single value.
Examples: ++ (increment), -- (decrement), + (unary plus), -
(unary minus), ! (logical NOT).
Example :
Ternary Operators :
Determine the type of a value.
Example: typeof (returns a string representing the type of a
value), instanceof (checks if an object is an instance of a
particular class or constructor).
Example :
Jimmy Ramani
@jimmyramani
8
Operators
Bitwise Operators :
Perform operations on binary representations of numbers.
Examples: & (bitwise AND), | (bitwise OR), ^ (bitwise XOR), ~
(bitwise NOT), << (left shift), >> (right shift), >>> (unsigned right
shift).
Example :
Type Operators :
Determine the type of a value.
Example: typeof (returns a string representing the type of a
value), instanceof (checks if an object is an instance of a
particular class or constructor).
Example :
Jimmy Ramani
@jimmyramani
9
Operators
String Operators :
Concatenate strings.
Example: + (concatenation).
Example :
Jimmy Ramani
@jimmyramani
10
Data Types
Number Represents both integer and floating-point numbers.
Jimmy Ramani
@jimmyramani
11
Data Types
Jimmy Ramani
@jimmyramani
12
Strings
Single Quotes (' ')
Strings created with single quotes are enclosed within single quotes.
Double Quotes (” ”)
Strings created with double quotes are enclosed within double quotes.
Backticks (``)
Backticks are used to create template literals, which offer more
advanced string features, such as string interpolation and multiline
strings.
Jimmy Ramani
@jimmyramani
13
Events
Types
User interactions: click, double-click, mouseover, mouseout, keydown,
keyup, etc.
HTML form events: submit, change, input, focus, blur, etc.
Window events: load, unload, resize, scroll, etc.
Network events: XMLHttpRequest events (readystatechange, load,
error), WebSocket events, etc.
Jimmy Ramani
@jimmyramani
14
Event Listener
clicked.
16
Function
Basic Syntax
Example :
Jimmy Ramani
@jimmyramani
17
You can also use arrow functions, which are a more concise way to
define functions:
Arrow functions are particularly useful for short and simple functions.
Jimmy Ramani
@jimmyramani
19
Array
An Array is a data structure that allows you to store and manage a
collection of values. Arrays can contain elements of various data types,
such as numbers, strings, objects, and even other arrays. Arrays are
widely used to organize and manipulate data in a structured manner.
https://www.linkedin.com/feed/update/urn:li:activity:7094369342
129139712?utm_source=share&utm_medium=member_desktop
Go Through
QR
More about Arrays Methods :
Jimmy Ramani
@jimmyramani
20
Getter & Setter
Getters and Setters are special methods that allow you to define how
the properties of an object are accessed and assigned. Getters are used
to retrieve the value of a property, while setters are used to set or modify
the value of a property. They provide a way to control the behavior of
accessing and modifying object properties.
Jimmy Ramani
@jimmyramani
21
Loops
For Loop
For-in Loop
Jimmy Ramani
@jimmyramani
22
Loops
For-of Loop
While Loop
Do While Loop
Jimmy Ramani
@jimmyramani
23
Type Conversion
Jimmy Ramani
@jimmyramani
24
Jimmy Ramani
@jimmyramani
25
Jimmy Ramani
@jimmyramani
26
CallBack
a callback is a function that is passed as an argument to another
function and is intended to be executed later, often after an
asynchronous operation or a certain event occurs. Callbacks are a
fundamental concept in JavaScript and are commonly used to handle
asynchronous operations, such as AJAX requests, timers, and event
handling.
Go Through
https://www.linkedin.com/feed/update/urn:li:activity:710231080144
8853505?utm_source=share&utm_medium=member_desktop
QR
More about Promises :
Jimmy Ramani
@jimmyramani
28
Async - Await
async/await is a modern JavaScript feature that provides a cleaner
and more concise way to work with asynchronous code compared to
using callbacks or Promises directly. It makes asynchronous code look
more like synchronous code, improving readability and maintainability.
https://www.linkedin.com/feed/update/urn:li:activity:71027261374
57344512?utm_source=share&utm_medium=member_desktop
Go Through
QR
More about Promises :
Jimmy Ramani
@jimmyramani
29
Clousure
A closure in JavaScript is a function that "remembers" its lexical scope
even when it's executed outside that scope. In simpler terms, a closure
allows a function to access variables from its outer (enclosing) function
even after that outer function has finished executing.
Jimmy Ramani
@jimmyramani
30
Timer
Timers in JavaScript are used to schedule the execution of a function or
a piece of code after a certain amount of time has passed. There are
three main timer functions available in JavaScript: setTimeout,
setInterval, and clearTimeout.
Jimmy Ramani
@jimmyramani
30
Proto-Typing
prototyping is a mechanism that allows objects to inherit properties
and methods from other objects. Objects in JavaScript have a
prototype chain that defines their inheritance hierarchy. Every object is
linked to a prototype object, and this chain continues until the base
object, which has null as its prototype.
Jimmy Ramani
@jimmyramani
31
Jimmy Ramani
@jimmyramani
32
Generators
Generators are a unique feature introduced in ECMAScript 6 (ES6) that
allow you to pause and resume the execution of a function. They are
created using a special kind of function called a generator function.
Generator functions are defined using an asterisk (*) after the function
keyword, and they contain one or more yield expressions that indicate
where the function can be paused and resumed.
Jimmy Ramani
@jimmyramani
34
Inheritance
Inheritance is a fundamental concept in object-oriented programming
that allows you to create new classes (subclasses or child classes)
based on existing classes (superclasses or parent classes). In
JavaScript, inheritance is implemented using prototypes and
constructor functions.
Go Through
QR
Jimmy Ramani
@jimmyramani
35
Regular Expressions
Regular Expressions, often referred to as RegEx or RegExp, are powerful
patterns used for matching character combinations in strings.
JavaScript provides built-in support for regular expressions through the
RegExp object and regular expression literals.
Using Regular
Expression
Literals
Jimmy Ramani
@jimmyramani
36
Projects
Jimmy Ramani
@jimmyramani
WAS THIS
HELPFUL?
Share with a friend who needs it!
Jimmy Ramani
@jimmyramani