Skip to content

Commit 01595e4

Browse files
committed
Initial commit
0 parents  commit 01595e4

File tree

254 files changed

+13780
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

254 files changed

+13780
-0
lines changed

.vscode/settings.json

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"editor.fontFamily": "Cascadia Code",
3+
"liveServer.settings.port": 5501
4+
}
+74
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
// We can differentiate var, let and const keywords as follows-->
2+
3+
/*
4+
Short Overview---->
5+
1. Scope-> var doesn't have block scope it is globally scoped where 'let' and 'const' have block scope
6+
2. Re_Declare-> var can be redeclare where let and const can't be redeclare.
7+
3. Re_Initialization-> var and let can be redeclare unlike const.
8+
4. for const variables we have to initialize it at the time of declaration unlike var and let.
9+
*/
10+
11+
//-------------------------- Practical Overview ----------------------------------------
12+
13+
// -------------------------------------------------------------
14+
// 1. on the basis of "SCOPE"-->
15+
// var doesn't have block scope it is globally scoped where 'let' and 'const' have block scope
16+
// for example---->
17+
18+
{
19+
var fullName = 'Sandhya Dwivedi';
20+
let DOB = '23/07/1999';
21+
const age = 24.5;
22+
}
23+
// if we want to access these values outside the block output will be-->
24+
// console.log(fullName) // Sandhya Dwivedi globaly scoped
25+
// console.log(DOB) // DOB is not defined due to block scope
26+
// console.log(age) // age is not defined due to block scope
27+
// *uncomment all consol.logs to see output
28+
29+
// -------------------------------------------------------------
30+
31+
// 2. on the basis of "REDECLARATION"-->
32+
// var can be redeclare where let and const can't be redeclare.
33+
// for Example var can be redeclare-->
34+
var fullName = 'Sandhya Dwivedi';
35+
var fullName = 'Sandhya Dwivedi';
36+
console.log(fullName); // last output--> Sandhya Dwivedi
37+
/*
38+
let DOB = '23/07/1999'
39+
let DOB = '23/07/1999'
40+
const age = 24.5;
41+
const age = 24.5;
42+
*/
43+
// We can't do this because let and const can't be redeclare it will throw an error
44+
// *uncomment krke dekh sakte ho
45+
46+
// -------------------------------------------------------------
47+
48+
// 3. on the basis of "RE_INITIALIZATION"-->
49+
// var and let can be re-initialized unlike const--
50+
51+
var fullName = 'Sandhya Dwivedi';
52+
fullName = 'sandhya.dwivedi.5454';
53+
console.log(fullName) // output--> sandhya.dwivedi.5454
54+
55+
let DOB = '23/07/1999';
56+
DOB = '23/07/2001';
57+
console.log(DOB) // output--> 23/07/2001
58+
59+
const age = 24.5;
60+
age = 24.6;
61+
console.log(age) // output --> throw an error - can't reassign values to const variables
62+
63+
// -------------------------------------------------------------
64+
65+
// 4. on the basis of "INITIALIZATION while Declaring variables"-->
66+
// for const variables we have to initialize it at the time of declaration unlike var and let
67+
// for Example-->
68+
69+
// const myName; // we can't do this it will throw an error
70+
const myName = 'Surendra Jatav'
71+
72+
let name;
73+
var name1;
74+
+66
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
/*
2+
In JavaScript, there are several data types. The primitive data types are:
3+
4+
String: Represents a sequence of characters. It is defined using either single quotes (' ') or double quotes (" ").
5+
let string1 = 'Hello World';
6+
let string2 = "Hello JavaScript";
7+
8+
Number: Represents a numeric value. In JavaScript, there is only one number type, which can contain both integers and floating-point values.
9+
let num1 = 10; // Integer
10+
let num2 = 3.14; // Floating-point number
11+
12+
Boolean: Represents a true or false value. It is commonly used in conditional expressions.
13+
let bool1 = true;
14+
let bool2 = false;
15+
16+
Null: Represents a null value, which can be assigned to a variable. It represents an empty or non-existent value.
17+
let nullValue = null;
18+
19+
Undefined: Represents an undefined value. In JavaScript, this value is automatically assigned to variables that have been declared but not initialized.
20+
let undefinedValue;
21+
console.log(undefinedValue); // Output: undefined
22+
23+
Symbol: Represents a unique identifier or a symbol in JavaScript.
24+
let symbol1 = Symbol('description');
25+
26+
BigInt: Represents an arbitrary large integer, larger than the maximum safe integer limit (2^53 - 1).
27+
let bigInt1 = 12345678901234567890n;
28+
29+
*/
30+
31+
/*
32+
Non-Premetive---->
33+
34+
There is only one premetive data type that is called Object and Object are devided into three categories.
35+
36+
Object literals:
37+
Represents a collection of properties and each property is a association between a unique key and a value.
38+
let object1 =
39+
{ key1: 'value1', key2: 'value2' };
40+
41+
Arrays :
42+
Represents an ordered collection of items, where each item is a value and can be accessed by an index.
43+
let array1 = [1, 2, 3, 4, 5];
44+
45+
Functions :
46+
Represents a function or a reusable piece of code that can be defined once and called multiple times.
47+
function add(a, b) {
48+
return a + b;
49+
}
50+
51+
----------------
52+
53+
NOTE: Date and Promises are also Object literals.
54+
Date:
55+
Represents a specific moment in time.
56+
let currentDate = new Date();
57+
58+
Promise:
59+
Represents an object that represents an eventual completion or failure of an asynchronous operation and its resulting value.
60+
let promise1 = new Promise((resolve, reject) => {
61+
setTimeout(() => {
62+
resolve('Promise resolved');
63+
}, 1000);
64+
});
65+
66+
*/
+38
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
Variable:
3+
It is a reserved memory location.
4+
It is used to store data of specific type.
5+
var and let introduced in ECMAScript 5.
6+
const and arrow function in ES6
7+
8+
---------------------------------------------------
9+
10+
RAM:Random Access Memory
11+
It is a temporary storage of data.
12+
13+
===============================================
14+
15+
Keywords:It is a reserved words which is used by compiler. whose definition is load in the memory of compiler.
16+
17+
----------------------------------------------
18+
19+
Javascript:It is used to make dynamic changes in a web page.
20+
It supports OOPS(Object Oriented Programming Structure) features.
21+
It is a programming language.
22+
23+
=================================================
24+
25+
Document: It represents a web page.
26+
When we load a web page in a browser, automatically a document object is created.
27+
By using document object we can directly access HTML elements using DOM.
28+
DOM:
29+
D:Document(.html)
30+
O:Object(HTML Element,Node)
31+
M:Modal(Tree Structure)
32+
*/
33+
34+
//PRACTICAL -
35+
36+
//name is a variable that stores a string.
37+
let name = 'Sandhya Dwivedi' //let keyword is used for declaring variable with block scope.
38+
console.log('Name : ',name); // Output: Name : Sandhya Dwivedi
+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// types of operators in js-->
2+
// arithmetic operator --> +,-,*,/,%, **(exponential or power)
3+
// assignment operator --> =
4+
// comparison operator --> ==, !=, > ,<, >=, <=,===(compare value and data types)
5+
// logical operator --> && (and), ||(or)
6+
// bitwise operators-->
7+
// NOT operator--> to flip the value
8+
// Shift operators-->
9+
// << is left shift and >> is right shift.
10+
11+
// add string to integer
12+
13+
// concatenation using '+' operator
14+
console.log("Hello " + "World");
15+
16+
let x = 10;
17+
+console.log("6" + x);
18+
// if we add any int to any number it will conver int to string by default
19+
20+
//but when we use substraction it wil perform unlike addition
21+
console.log("6" - x); //output -4
22+
23+
console.log("6" - -x); // output 16
24+
25+
console.log("6" + +x); // output 610
26+
27+
console.log("6" - +x); // output -4
28+
29+
console.log("6" + -x); // output 6-10
30+
// first sign has higher preference where second is define number is negative or positive
31+
32+
// console.log("6" + / x); not working
33+
34+
// combined (compound) operators -
35+
/*
36+
Addition assignment operator (+=): a += b is equivalent to a = a + b.
37+
Subtraction assignment operator (-=): c -= d is equivalent to c = c – d.
38+
Multiplication assignment operator (*=): e *= f is equivalent to e = e * f.
39+
Division assignment operator (/=): g /= h is equivalent to g = g / h.
40+
Modulus assignment operator (%=): i %= j is equivalent to i = i % j.
41+
Exponentiation assignment operator (**=): k **= l is equivalent to k = k**l.
42+
*/
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
/*
2+
Type Conversion in JS-->
3+
Converting one data type to another is called as Type conversion.
4+
5+
Types of conversion --->
6+
1. Implicit type conversion:
7+
- When we assign a value of one data type to another without explicitly converting it, JavaScript does the conversion for us.
8+
2. Explicit type conversion: (Manually)
9+
using parseInt(), parseFloat() methods, Number() method and String() method we can convert one data type to another.
10+
*/
11+
12+
13+
// type conversions------>
14+
console.log("Hello " + "World");
15+
16+
let x = 10;
17+
console.log("6" + x);
18+
// if we add any string to any number it will convert int to string by default (implicite conversion)
19+
20+
//but when we use substraction it will perform unlike addition(Implicite conversion)
21+
console.log("6" - x); //output -4
22+
23+
console.log("6" - - x); // output 16
24+
25+
console.log("6" + + x); // output 610
26+
27+
console.log("6" - + x); // output -4
28+
29+
console.log("6" + - x); // output 6-10 // first sign has higher preference where second is define number is negative or positive
30+
31+
// console.log("6" + / x); not working
32+
33+
console.log(x - + "6"); // output -4
34+
console.log(x - "6"); // output 4
35+
// subtraction sign convert string into number by-default
36+
// Addition operator concat strings if we try to add number to a string it will be concanated.
37+
38+
//Some methods (explicit conversion)-------->
39+
//1. String()
40+
//2. Number()
41+
//3. Boolean()
42+
43+
let type = 'Hello'
44+
console.log(typeof type);
45+
46+
type = Number(type);
47+
console.log(typeof type);
48+
console.log(type); // Output--->NaN
49+
50+
type = 32
51+
type = String(type);
52+
console.log(typeof type);
53+
console.log(type);
54+
55+
// type = '' empty string will be marked as false
56+
type = 'Surendra' //Output true
57+
type = Boolean(type)
58+
console.log(type)
59+
60+
// type = 1 // all numbers except 0 will be marked as true
61+
type = 0 // Output false
62+
type = Boolean(type);
63+
console.log(typeof type);
64+
console.log(type);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
// Conditional Statements---->
2+
3+
// Syntax-->
4+
5+
/*
6+
1. if (condition){
7+
code block to be executed if the condition is true;
8+
}
9+
10+
//-------------------------------------------------------------
11+
12+
2. if (condition){
13+
code block to be executed if the condition is true;
14+
}else{
15+
code block to be executed if the condition is false;
16+
}
17+
18+
//--------------------------------------------------------------
19+
20+
it's called else_if ladder--> all condition will be checked one by one util get true condition.
21+
22+
3. if(condition_1){
23+
code block to be executed if the condition_1 is true;
24+
}else if(condition_2){
25+
code block to be executed if the condition_2 is true;
26+
}else if(condition_3){
27+
code block to be executed if the condition_3 is true;
28+
}else if(condition_4){
29+
code block to be executed if the condition_4 is true;
30+
}else{
31+
code block to be executed if none of the conditions are true;
32+
}
33+
34+
//-------------------------------------------------------------
35+
36+
Switch_Case----->
37+
38+
let a = 5
39+
switch (a){
40+
case 1:{
41+
console.log("one")
42+
break;
43+
}
44+
case 3:{
45+
console.log("three")
46+
break;
47+
}
48+
case 5:{
49+
console.log("five")
50+
break;
51+
}
52+
default: {
53+
console.log("Not in list");
54+
}
55+
}
56+
57+
*/
58+

Session01/01_ImpTheory/switchCase.js

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
let input = 1
2+
switch (input){
3+
case 1: {
4+
console.log('January')
5+
break;
6+
}
7+
case 2: {
8+
console.log('feb')
9+
break
10+
}
11+
case 3: {
12+
console.log('march')
13+
break
14+
}
15+
case 4: {
16+
console.log('may')
17+
break
18+
}
19+
case 5: {
20+
console.log('jun')
21+
break
22+
}
23+
default: {
24+
console.log("Not in list");
25+
}
26+
}
27+

0 commit comments

Comments
 (0)