0% found this document useful (0 votes)
8 views

Java Script

Notes for Javascript
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Java Script

Notes for Javascript
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

JavaScript Fundamentals

JavaScript is high-level language and just in time compiled (i.e., compiled


during execution and follow ECMA script standards (i.e., can run in any
browser).

Why javascript?

Variable Declarations:
1. let
2. const
Difference between let and const is that const declarations should be
initialized and cannot reassign with new value.
Whereas let we can reassign again.

Datatypes:

1.Primitive 2. Non- Primitive


1. String 1. objects
2. Number
3. Boolean
4. Undefined
5. Null
6. BigInt
7. Symbol
 Object:
It stores collection of data
--JavaScript is dynamically types language,i.e., we don’t have to declare the
datatype and datatypes are automatically converted as need during
execution.

Operator:
An operator is a special symbol used to perform operations on variables and
values.

1. Assignment Operator
2. Arithmetic operator
3. Comparison operator
4. Logical operator
5. String Operator
6. Other Operator

Type Conversions
1. Implicit conversion also known as type coercion where JavaScript itself
will automatically convert the type.
2. Explicit conversion where you manually convert the type.
Equality
== (Allows coercion)
=== (Does not allow coercion)
Conditional statements
1. If
2. Else
3. Elseif
4. Switch

2
Looping
Loops are used to repeat a block of code
1. While
2. Do...While
3. For
4. For...of loop

Functions
Functions are building blocks of JavaScript
 A Js function is a block of code designed to perform a particular task.
 Functions are reusable as they can be define once and can be called
with different values resulting in different results.
 Functions help to divide a complex problem into smaller chunks and
makes your program easy to understand and maintain.

Scope
Scope determines the accessibility or visibility of variables
1. Block scope
2. Function scope
3. Global scope

3
Advanced JavaScript

Nested Function’s Scope

 Closure
A closure is a combination of a function bundled together with
references to its surrounding state. Closures are created every time a
function is created at function creation time.

closure: In JavaScript, when we return a function from another


function, we are effectively returning a combination of the
function definition along with the function's scope.
This would let the function definition have an associated
persistent memory which could hold on to live data between
executions.
That combination of the function and its scope chain is what is
called a closure in JavaScript.

 Function Currying

Currying is a process in functional programming in which we transform


a function with multiple arguments into a sequence of nesting
functions that take one argument at a time.
Function F(a,b,c) is transformend to F(a)(b)(c)

4
This Keyword:
The JavaScript this keyword which is used in a function, refers to the
object it belongs to.
It makes functions reusable by letting you decide the object value.
This value is determined entirely by how a function is called.

You might also like