diff --git a/.DS_Store b/.DS_Store
deleted file mode 100644
index b2c2c08..0000000
Binary files a/.DS_Store and /dev/null differ
diff --git a/.eslintrc.js b/.eslintrc.js
index f18fd69..4072011 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -3,9 +3,6 @@ module.exports = {
env: { es6: true },
rules: {
"indent": ["error", 2],
- "quotes": ["error", "double"],
- "semi": ["error", "always"],
- "eol-last": ["error", "never"],
"no-multiple-empty-lines": ["error", { max: 1 }]
}
};
diff --git a/.gitignore b/.gitignore
index d5f19d8..46096f2 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,3 @@
node_modules
package-lock.json
+.DS_Store
diff --git a/JavaScript_Advance/FilteringArray.js b/JavaScript_Advance/FilteringArray.js
deleted file mode 100644
index 08a1bf4..0000000
--- a/JavaScript_Advance/FilteringArray.js
+++ /dev/null
@@ -1,5 +0,0 @@
-const animals = ["cats", "dogs", "bunnies", "birds"];
-
-const start_with_b = animals.filter(name => name.indexOf("b") === 0);
-
-console.log(start_with_b); // ['bunnies', 'birds']
\ No newline at end of file
diff --git a/JavaScript_Advance/ajax.js b/JavaScript_Advance/ajax.js
deleted file mode 100644
index 1993fee..0000000
--- a/JavaScript_Advance/ajax.js
+++ /dev/null
@@ -1,10 +0,0 @@
-/*If we want to access the data, we need two .then() handlers (callback). But if we want to manipulate the resource, we need only one .then() handler. However, we can use the second one to make sure the value has been sent.*/
-// Basic blueprint
-fetch(url)
- .then(response.something) // Define response type (JSON, Headers, Status codes)
- .then(data) // get the response type
-
-// Practical example
-fetch('https://jsonplaceholder.typicode.com/todos')
- .then(response => response.json())
- .then(data => console.log(JSON.stringify(data)))
diff --git a/JavaScript_Advance/arrowFunction.js b/JavaScript_Advance/arrowFunction.js
deleted file mode 100644
index e63098f..0000000
--- a/JavaScript_Advance/arrowFunction.js
+++ /dev/null
@@ -1,62 +0,0 @@
-let a = () => {
- // This is arrow function came new in ES6
-};
-
-let info = {
- firstName: "Swapnil",
- lastName: "Shinde",
- getFullName: () => {
- return(`My name is ${this.firstName} ${this.lastName}`); // Arrow functions don't have "this" property
- }
-}
-
-console.log(info.getFullName());
-// Output My name is undefined undefined that's why we don't use this with arrow function
-
-let newInfo = {
- firstName: "Swapnil",
- lastName: "Shinde",
- getFullName: () => {
- return(`My name is ${newInfo.firstName} ${newInfo.lastName}`); // If we are using arrow function then directly use the variables as shown
- }
-}
-
-console.log(newInfo.getFullName());
-// Output My name is Swapnil Shinde
-
-// Using arrow functions in Class
-class Student {
- constructor() {
- this.name = 'Vishal'
- }
-
- getName = () => {
- return this.name;
- }
-}
-
-console.log((new Student).getName()) // Gives error for node versions before 12.4.0(Approx) SyntaxError: Unexpected token =
-
-class StudentInfo {
-
- constructor (firstName,lastName, age, branch, college){
- this.firstName = firstName;
- this.lastName = lastName;
- this.age = age;
- this.branch = branch;
- this.college = college;
- };
-
- getFullName = () => { // Returns full name using string interpolation
- return(`My name is ${this.firstName} ${this.lastName}`); // If we are using arrow function then directly use the variables as shown
- };
-
- getBranch = () => { // Returns Branch
- return(this.branch);
- };
-
-}
-
-let Swapnil = new StudentInfo("Swapnil", "Shinde",19, "Computer", "Sies"); // This way we can create new objects with arguments
-
-console.log(Swapnil.getFullName()); // Output My name is Swapnil Shinde
\ No newline at end of file
diff --git a/JavaScript_Advance/assignments-arithmetic.js b/JavaScript_Advance/assignments-arithmetic.js
deleted file mode 100644
index df39187..0000000
--- a/JavaScript_Advance/assignments-arithmetic.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/* In javascript there are always several ways to the goal.
-Also the syntax of variable assignment can be abbreviated.
-This is particularly suitable for mathematic operators
-*/
-
-/* Default assignment
-Very basic to this point.
-*/
-
- y = "Yes" // y: "Yes"
-
-/* Adding
-Adds two values.
-*/
-
- // Basic adding
- y = 1 + 1 // y: 2
-
- // Shortcut
- y += 1 // y: 3 (increases y by 1)
-
- // appending strings by adding
- y = "A" // y: "A"
- y += "B" // y: "AB"
-
- // Adding string and number
- y = 1 // y: 1
- y += "1" // y: "11" (treated as text not as numbers)
-
-/* Subtracting
-subtracts two values
-*/
-
- // Basic adding
- y = 5 - 2 // y: 3
-
- // Shortcut
- y -= 1 // y: 2
-
- // substracting strings
- y = "A" // y: "A"
- y -= "B" // y: NaN (Not-a-Number aka we-don't-know-what-it-is-but-definitively-not-decimal)
-
- y = "AA" // y: "AA"
- y -= "A" // y: NaN (also not working)
-
- // substracting strings and numbers
- y = 3 // y: 3
- y -= "1" // y: 2
-
- y = "3" // y: "3"
- y -= 1 // y: 2
-
-/* Multiplication
-Multiply two values
-*/
-
- // Basic
- y = 3 * 2 // y: 6
-
- // Shortcut
- y *= 2 // y: 12 (doubles y)
- y *= 3 // y: 36 (triples y)
-
- // Multiplying strings
- y = "A" * 3 // y: NaN (doesn't work)
-
- /* Sadly you can't repeat strings by multiplying them. Alternatives:
- https://www.freecodecamp.org/news/three-ways-to-repeat-a-string-in-javascript-2a9053b93a2d/
- */
-
-/* Dividing
-Multiply two values
-*/
-
- // Basic
- y = 5 / 2 // y: 2.5
-
- // Shortcut
- y = 64
- y /= 2 // y: 32 (divides y by two)
- y /= 4 // y: 8 (divides y by four)
-
-/* Modulo
-Short modulo example:
- 5 % 3 = 2 (3 fits inside 5 one time, 2 remaining)
- 5 % 2 = 1 (2 fits inside 5 two times, 1 remaining)
- 5 % 5 = 0 (5 fits inside 5 one time, 0 remaining)
-By modulo 2 you get 1 if the number is odd and 0 if it's even.
-*/
-
- // Basic
- y = 5 % 4 // y: 1
-
- // Shortcut
- y = 5
- y %= 4 // y:1
-
- // Is y odd or even?
- y = 127
- y %= 2 // y: 1 (1 => odd)
-
- y = 128
- y %= 2 // y: 0 (0 => even)
-
-/* Power
-*/
-
- // Basic
- y = 5 ** 2 // y: 25
-
- // Shortcut
- y = 5
- y **= 2 // y: 25
diff --git a/JavaScript_Advance/assignments-bitwise.js b/JavaScript_Advance/assignments-bitwise.js
deleted file mode 100644
index 5073907..0000000
--- a/JavaScript_Advance/assignments-bitwise.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* In javascript there are always several ways to the goal.
-Also the syntax of variable assignment can be abbreviated.
-This is also suitable for bitwise operations
-*/
-
-/* left shift
-*/
-
- // Basic
- y = 3 // y: 111 (binary)
- x = 2
- y = y << x // y: 11100 (binary)
-
- // Shortcut
- y = 3 // y: 111 (binary)
- x = 2
- y <<= x // y: 11100 (binary)
-
-/* right shift (sign preserving)
-*/
-
- // Basic
- y = -5 // y: 11111111111111111111111111111011 (binary)
- x = 1
- y = y >> x // y: 11111111111111111111111111111101 (binary) -3 (decimal)
-
- // Shortcut
- y = -5 // y: 11111111111111111111111111111011 (binary)
- x = 1
- y >>= x // y: 11111111111111111111111111111101 (binary) -3 (decimal)
-
-/* right shift (zero fill)
-*/
-
- // Basic
- y = 5 // y: 00000000000000000000000000000101 (binary)
- x = 1
- y = y >>> x // y: 00000000000000000000000000000010 (binary) 2 (decimal)
-
- // Shortcut
- y = 5 // y: 00000000000000000000000000000101 (binary)
- x = 1
- y >>>= x // y: 00000000000000000000000000000010 (binary) 2 (decimal)
-
-/* AND
-*/
-
- // Basic
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y = y & x // y: 1000 (binary)
-
- // Shortcut
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y &= x // y: 1000 (binary)
-
-/* OR
-*/
-
- // Basic
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y = y | x // y: 1101 (binary)
-
- // Shortcut
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y |= x // y: 1101 (binary)
-
-/* XOR
-*/
-
- // Basic
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y = y ^ x // y: 0101 (binary)
-
- // Shortcut
- y = 12 // y: 1100 (binary)
- x = 9 // y: 1001 (binary)
- y ^= x // y: 0101 (binary)
-
-/* NOT
-*/
-
- // Basic
- y = 5 // y: 00000000000000000000000000000101 (binary)
- y = ~y // y: 11111111111111111111111111111010 (binary) -6 (decimal)
diff --git a/JavaScript_Advance/bind.js b/JavaScript_Advance/bind.js
deleted file mode 100644
index a8a6252..0000000
--- a/JavaScript_Advance/bind.js
+++ /dev/null
@@ -1,19 +0,0 @@
-/*The bind() method creates a new function that, when called, has its this keyword set
-to the provided value, with a given sequence of arguments preceding any provided
-when the new function is called.
-*/
-let module = {
- x: 42,
- getX: function() {
- return this.x;
- }
- }
-
- let unboundGetX = module.getX;
- console.log(unboundGetX()); // The function gets invoked at the global scope
- // expected output: undefined
-
- let boundGetX = unboundGetX.bind(module);
- console.log(boundGetX());
- // expected output: 42
-
\ No newline at end of file
diff --git a/JavaScript_Advance/callback.js b/JavaScript_Advance/callback.js
deleted file mode 100644
index ae80933..0000000
--- a/JavaScript_Advance/callback.js
+++ /dev/null
@@ -1,153 +0,0 @@
-/**
- * Callback functions are derived from a programming paradigm called
- * `functional programming`. This basically can be concluded to this sentence:
- * You can pass (`closure`) functions as an argument to another function.
- *
- * Higher order functions:- In javascript, functions can be used as value.
- * We can assign function to a variable.
- * Pass them as parameters to another functions.
- * Return them from a function
- *
- * Callback:- We pass a function as parameters to another function, which calls/invokes
- * the provided function. Hence the name Callback
- *
- *
- *
- * look at this example:
- */
-
-const sayHi = (afterHi) => {
- console.log('Hi, ')
- return afterHi()
-}
-
-sayHi(() => { console.log('How are you?') })
-// [out] 'Hi, '
-// [out] 'How are you?'
-
-/**
- * If you look at the way we called `sayHi`, you will see that, we have not called
- * the function which is going to print `'How are you?'`, we have not even named it (Anonymous function)
- * This is the prototype of the function. The passed function, will act as if it has been defined
- * inside the `sayHi` function. Therefore, you can assume that your function has access to the scope
- * of the other function.
- *
- * example:
- */
-
- const transformNumber = (num, operator) => {
- let test = 2;
- console.log(num)
- console.log(test)
- operator(num)
- console.log(num)
- console.log(test)
- }
-
- transformNumber(10, (num) => {
- num = num * num;
- test = 3
- })
- // [out] 10
- // [out] 2
- // [out] 100
- // [out] 3
-
- /**
- * One of very common uses of callback functions, is in `Promises`.
- * I suggest you read `promises.js` file, before continuing this section.
- * If you know about javascript `Promise` concept, you should be familiar with
- * `.then()` and `.catch()` functions. These are `Promise`'s prototype methods.
- * When a promise gets resolved (when `.resolve()` gets called), all the arguments
- * passed to the `resolve()` function, will get passed to the function passed to `.then()`
- * function. Look at the following example from MDN official documents:
- */
- var p1 = new Promise((resolve, reject) => {
- resolve('Success!');
- // or
- // reject(new Error("Error!"));
- });
-
- p1.then(value => {
- console.log(value); // Success!
- }, reason => {
- console.error(reason); // Error!
- });
-
-/**
- * So, basically the function that we pass to `.then()` function, is a `callback` function.
- *
- * We see usage of `Promise` widely in different API call scenarios.
- * Different HTTP libraries (`fetch, axios, ...`), use javascript `Promise` object,
- * for handling `onSuccess` and `onError` scenarios when calling an API endpoint.
- * When you make an API call, if everything goes well and server's response has some
- * 2xx status code, this API call will be considered as `success` and otherwise, it has `failed`,
- * and some `error` messages should be returned.
- *
- * In the following example, we are going to use `axios` as our HTTP library.
- * But you can simulate the exact same scenario using any other HTTP libraries.
- *
- */
-
-axios
- .get('https://cat-fact.herokuapp.com/facts/random')
- .then(response => {
- console.log(response, 'success!')
- })
- .catch(error => {
- console.log(error, 'failed!')
- })
-
-/**
- * This process of making HTTP requests can get pretty much complicated.
- * There are many cases that you need to make several API calls which each
- * of them, will rely on the response from some previous requests.
- *
- * (In this tutorial, we are using the `cat-facts` public API to demonstrate
- * different usages of HTTP libraries. You can read the documentation related
- * to this API, here: https://alexwohlbruck.github.io/cat-facts/docs/)
- *
- * Let's say we want to retrieve 2 random facts about cats and after retrieving
- * the list of 2 facts, start making another API call to retrieve details of each.
- *
- * According to `cat-facts` docs, we will receive an `_id` field in the list of facts
- * and when we make an API call to `/facts/:id` endpoint, we can get details of that specific fact.
- *
- * Look at the following code snippet:
- */
-
-axios({
- url: 'https://cat-fact.herokuapp.com/facts/random',
- method: 'GET',
- params: {animal_type: 'cat', amount: '2'}
-}).then(response => {
- console.log('list success!')
- response.data.forEach((fact, idx) => {
- axios
- .get(`https://cat-fact.herokuapp.com/facts/${fact._id}`)
- .then(factRes => { console.log(`fact #${idx} success: `, factRes) })
- .catch(factErr => { console.log(`fact #${idx} failed: `, factErr) })
- })
-}).catch(err => {
- console.log(err, 'list failed!')
-})
-
-/**
- * You can see that sometimes, we need to make API calls that rely on
- * response of some other API call, therefore we need to make those calls
- * in order, and also, if one of these API calls somewhere in this chain fails,
- * we do not want to continue making next API calls.
- * This specific scenario, can be extended in real lif usage of APIs. You might
- * face some situations that you need to chain more than 4-5 API calls. In these
- * cases, one will end up writing many nested `.then().catch()` blocks. Also,
- * it is not True that we "Always" want to ignore making API calls next in chain,
- * if one of requests in chain fails. So, different situations and more exceptions
- * to handle and apparently, more nested `.then().catch()` code blocks.
- *
- * This situations is referred to as `Callbacks Hell`. It really can turn in to a
- * mess, if you don't take cautions in writing your clean and readable using callback
- * functions. To solve this issue, one might advise to use `async` `await` syntaxes,
- * instead of using callback functions. This approach also have pros and cons. One of
- * the cons of this approach, is instead of nested `.then()` blocks, you are going to
- * need nested `try` `catch` blocks. Sometimes this kind of problems are inevitable.
- */
\ No newline at end of file
diff --git a/JavaScript_Advance/cookies.js b/JavaScript_Advance/cookies.js
deleted file mode 100644
index 17c3a63..0000000
--- a/JavaScript_Advance/cookies.js
+++ /dev/null
@@ -1,42 +0,0 @@
-// #1 Simple usage of cookies
-document.cookie = "movie=Jungle Book";
-document.cookie = "actor=Balu";
-console.log("Simple usage:" + document.cookie);
-
-// #2 Get a cookie with the name 'actor'
-document.cookie = "movie=Jungle Book";
-document.cookie = "actor=Balu";
-var cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)actor\s*\=\s*([^;]*).*$)|^.*$/, "$1");
-console.log("Cookie with the name 'actor':" + cookieValue);
-
-// #3 Set cookie and execute code only once if cookie doesn't exist yet
-if (document.cookie.replace(/(?:(?:^|.*;\s*)doThisOnlyOnce\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== "true") {
- alert("Do something here!");
- document.cookie = "doThisOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
-}
-// Reset the previous code
-document.cookie = "doThisOnlyOnce=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
-
-// #4 Check a cookie existence
-// ES5
-if (document.cookie.split(";").filter(function (item) {
- return item.trim().indexOf("actor=") == 0;
-}).length) {
- console.log("The cookie \"reader\" exists (ES5)");
-}
-// ES2016
-if (document.cookie.split(";").filter((item) => item.trim().startsWith("actor=")).length) {
- console.log("The cookie \"actor\" exists (ES6)");
-}
-
-// #5 Check that a cookie has a specific value
-// ES5
-if (document.cookie.split(";").filter(function (item) {
- return item.indexOf("actor=Balu") >= 0;
-}).length) {
- console.log("The cookie \"actor\" has \"Balu\" for value (ES5)");
-}
-// ES2016
-if (document.cookie.split(";").filter((item) => item.includes("actor=Balu")).length) {
- console.log("The cookie \"actor\" has \"Balu\" for value (ES6)");
-}
\ No newline at end of file
diff --git a/JavaScript_Advance/defaultValues.js b/JavaScript_Advance/defaultValues.js
deleted file mode 100644
index a332678..0000000
--- a/JavaScript_Advance/defaultValues.js
+++ /dev/null
@@ -1,13 +0,0 @@
-const helpGST = (name, age) => {
- console.log(name, age);
-};
-
-helpGST(); // Output will be undefined undefined
-
-const helpGSTWithDefaultValues = (name, age = 19) => {
- console.log(name, age);
-};
-
-helpGSTWithDefaultValues("Swapnil"); // Output Swapnil 19
-
-helpGSTWithDefaultValues("Vishal", 23); // Output Vishal 23
\ No newline at end of file
diff --git a/JavaScript_Advance/destructuring.js b/JavaScript_Advance/destructuring.js
deleted file mode 100644
index 7bf3d48..0000000
--- a/JavaScript_Advance/destructuring.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// As data coming from the server is very big then there is better way of getting the data out of object
-
-const a = { // Suppose this is the object coming from server then
- name: "Swapnil",
- age: 19,
- college: "SIES"
-};
-
-// By using Destructuring we can get the data of specific keys out into variables
-
-const { name, age, college } = a; // This way name variable gets "Swapnil" this is possible because the object also has same key
-
-console.log(name); // Output Swapnil
-
-const { name: Myname } = a; // This way Myname variable get assigned the value of name key in from object a
-
-console.log(Myname); // Output Swapnil
-
-array = [1, 2, 3, 4]; // Array Declaration
-
-const [first, second, , fourth] = array; // Array Destructuring
-
-// In this the Order of variables matters the most as arrays don't have keys
-
-// For skipping some values we can do that using as shown here we have skipped the third value
-console.log(fourth); // Output 4
-
-newArray = ["Swapnil", 19, "Shinde"]; // New array
-
-const [firstName, , lastName] = newArray; // Destructured the firstName and lastName
-
-console.log(`My name is ${firstName} ${lastName}`);// Output My name is Swapnil Shinde
\ No newline at end of file
diff --git a/JavaScript_Advance/eventloop.js b/JavaScript_Advance/eventloop.js
deleted file mode 100644
index 99e4a14..0000000
--- a/JavaScript_Advance/eventloop.js
+++ /dev/null
@@ -1,7 +0,0 @@
-setTimeout(() => {
- console.log("Hey im setTimeout");
-}, 3000); // Here program goes into waiting state till timer becomes zero
-
-console.log("Last statement"); // This statement gets printed first
-
-// This enables the non blocking using event based management
\ No newline at end of file
diff --git a/JavaScript_Advance/express.js b/JavaScript_Advance/express.js
deleted file mode 100644
index 9fa4b15..0000000
--- a/JavaScript_Advance/express.js
+++ /dev/null
@@ -1,14 +0,0 @@
-const express = require("express");
-
-const port = 3003;
-const app = express();
-
-const routes = express.Router();
-
-routes.get("/system_info", (req, res) => {
- res.send("System on!");
-});
-
-app.use(express.json());
-app.use(routes);
-app.listen(port, () => console.log(`Server running in port ${port}`));
\ No newline at end of file
diff --git a/JavaScript_Advance/functionAsObject.js b/JavaScript_Advance/functionAsObject.js
deleted file mode 100644
index 9c01f08..0000000
--- a/JavaScript_Advance/functionAsObject.js
+++ /dev/null
@@ -1,16 +0,0 @@
-/*
-
-Functions are special type of objects that has key-value pairs along with some code which gets executed
-
-*/
-
-function returnName(name){
- return name;
-}
-
-returnName.hiddenObj = {
- name: 'i am a javascript object'
-}
-
-console.log(returnName('hello')); // hello
-console.log(returnName.hiddenObj); // { name : 'i am a javascript object' }
\ No newline at end of file
diff --git a/JavaScript_Advance/hoisting.js b/JavaScript_Advance/hoisting.js
deleted file mode 100644
index d6574cb..0000000
--- a/JavaScript_Advance/hoisting.js
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
-
-Hoisting: Before executing any code, the javscript engine sets up memory for variables and functions.
-variables are assigned undefined by the engine.
-*/
-
-//Example 1
-x = 5; // Assign 5 to x
-
-elem = document.getElementById("demo"); // Find an element
-elem.innerHTML = x; // Display x in the element
-
-var x; // Declare x
-
-//Example 2
-var x; // Declare x
-x = 5; // Assign 5 to x
-
-elem = document.getElementById("demo"); // Find an element
-elem.innerHTML = x; // Display x in the element
-
-//________________________________________________________
-/* Conclusion :Example 1 gives the same result as Example 2
-so, Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope
-(to the top of the current script or the current function)
-*/
diff --git a/JavaScript_Advance/mapObject.js b/JavaScript_Advance/mapObject.js
deleted file mode 100644
index f0b260a..0000000
--- a/JavaScript_Advance/mapObject.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
-Map : Object
-Maps allow associating keys and values similar to normal Objects except Maps allow any Object to be used as a
-key instead of just Strings and Symbols. Maps use get() and set() methods to access the values stored in the Map.
-A Map are often called a HashTable or a Dictionary in other languages.
-*/
-
-
-let map = new Map();
-
-map.set('1', 'str1'); // a string key
-map.set(1, 'num1'); // a numeric key
-map.set(true, 'bool1'); // a boolean key
-
-// remember the regular Object? it would convert keys to string
-// Map keeps the type, so these two are different:
-alert(map.get(1)); // 'num1'
-alert(map.get('1')); // 'str1'
-
-alert(map.size); // 3
-
-//Map can also use objects as keys.
-
-let john = {
- name: "John"
-};
-
-// for every user, let's store their visits count
-let visitsCountMap = new Map();
-
-// john is the key for the map
-visitsCountMap.set(john, 123);
-
-alert(visitsCountMap.get(john)); // 123
-/*
-Iteration over Map
-For looping over a map, there are 3 methods:
-
-map.keys() – returns an iterable for keys,
-map.values() – returns an iterable for values,
-map.entries()
-*/
-
-let recipeMap = new Map([
- ['cucumber', 500],
- ['tomatoes', 350],
- ['onion', 50]
-]);
-
-// iterate over keys (vegetables)
-for (let vegetable of recipeMap.keys()) {
- alert(vegetable); // cucumber, tomatoes, onion
-}
-
-// iterate over values (amounts)
-for (let amount of recipeMap.values()) {
- alert(amount); // 500, 350, 50
-}
-
-// iterate over [key, value] entries
-for (let entry of recipeMap) { // the same as of recipeMap.entries()
- alert(entry); // cucumber,500 (and so on)
-}
diff --git a/JavaScript_Advance/polymorphism.js b/JavaScript_Advance/polymorphism.js
deleted file mode 100644
index c2a372c..0000000
--- a/JavaScript_Advance/polymorphism.js
+++ /dev/null
@@ -1,44 +0,0 @@
-// Polymorphism is one of the basic principles of object-oriented programming (OOP)
-//It is the practice of designing objects to share behavior and be able to overwrite common behaviors associated with specific ones.
-
-// First create the class Person
-class Person {
- constructor(name) {
- this.name = name;
- }
-
- getName() {
- return this.name
- }
-
- getPosition() {
- return "Unemployed"
- }
-}
-
-// Extend the class Person with Employee
-class Employee extends Person {
- constructor(name, position, salary) {
- super(name); // super() calls the constructor of Person
-
- this.position = position;
- this.salary = salary;
- }
-
- getPosition() { //overwrites the method of person
- return this.position
- }
-
- getSalary() {
- return this.salary
- }
-}
-
-let person = new Person("James");
-let employee = new Employee("Torsten", "Developer", 45000);
-
-console.log(employee.getName()); // Output: Torsten
-console.log(person.getName()); // Output: James
-
-console.log(employee.getPosition()); // Output: Developer
-console.log(person.getPosition()); // Output: Unemployed
\ No newline at end of file
diff --git a/JavaScript_Advance/prototype.js b/JavaScript_Advance/prototype.js
deleted file mode 100644
index 7fc7395..0000000
--- a/JavaScript_Advance/prototype.js
+++ /dev/null
@@ -1,48 +0,0 @@
-// Prototypes are an extension for objects in javascript
-// we use to encapsulate certain functionality to an Object (like a Class)
-
-// first create an Object Person
-// that receive the name and lastName
-
-function Person (firstName, lastName) {
- this.firstName = firstName
- this.lastName = lastName
-}
-
-// We user the prototype keyword to add some functionality to this Person Object
-
-// add a method getName that return the name
-Person.prototype.getName = function () {
- return this.firstName
-}
-
-// add a method getLastName that return the lastName
-Person.prototype.getLastName = function () {
- return this.lastName
-}
-
-// add a method getFullName that return the name + lastName
-Person.prototype.getFullName = function () {
- return this.firstName + ' ' + this.lastName
-}
-
-// add a method getFormalName
-Person.prototype.getFormalName = function(){
- return this.lastName + ', ' + this.firstName;
-}
-
-// these methods appear in the __proto__ property of an Object instance of Person
-
-const max = new Person('Max', 'Payne');
-
-console.log(max.getName());
-// [out] Max
-
-console.log(max.getLastName());
-// [out] Payne
-
-console.log(max.getFullName());
-// [out] Max Payne
-
-console.log(max.getFormalName());
-// [out] Payne, Max
\ No newline at end of file
diff --git a/JavaScript_Advance/set-function.js b/JavaScript_Advance/set-function.js
deleted file mode 100644
index 662099b..0000000
--- a/JavaScript_Advance/set-function.js
+++ /dev/null
@@ -1,12 +0,0 @@
-let jobs = {
- set current(jobName) {
- this.jobArray.push(jobName);
- },
- jobArray: []
-}
-
-language.current = 'Plumber';
-language.current = 'Architect';
-
-console.log(language.log);
-// expected output: Array ["Plumber", "Architect"]
diff --git a/JavaScript_Advance/someMethod.js b/JavaScript_Advance/someMethod.js
deleted file mode 100644
index 1e154db..0000000
--- a/JavaScript_Advance/someMethod.js
+++ /dev/null
@@ -1,18 +0,0 @@
-//Array some() Method
-//The some() method executes the function once for each element present in the array:
-//If it finds an array element where the function returns a true value,
-// some() returns true (and does not check the remaining values)
-
-let arr = ['name','test name', 'testtwo','ship'];
-
-// syntax
-
-let found = arr.some((element) => {
- console.log(element) // nam ,test name, true; stop iterating
- // if the condition matched it doesn't check for the whole array
- // beneficial where you want to check if a property in a whole array exist
- return element.includes('test')
-})
-console.log(found) // true
-
-// it doesn't change the original array
diff --git a/JavaScript_Basics/Array-methods.js b/JavaScript_Basics/Array-methods.js
deleted file mode 100644
index 0a6dee3..0000000
--- a/JavaScript_Basics/Array-methods.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// 1. join() method
-const sayings = ["India" ,"is" ,"my" ,"country"];
-sayings.join(" - ");
-//Output : India-is-my-country
-
-// 2. concat() method
-var flowers = ["Rose", "Lotus"];
-var leaf = ["green", "lightgreen", "Darkgreen"];
-var garden = flowers.concat(leaf);
-//Output : Rose ,Lotus,green,lightgreen Darkgreen
-
-
-// 3. copyWithin() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-Country.copyWithin(2,0); // Output : India , Us , India , Us
-
-// 4.fill() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-Country.fill("Canada"); // Output : Canada, Canada , Canada, Canada
-
-// 5. find() method
-var years = [2000, 2001, 2002, 2003];
-console.log(years); // Output : 2000,2001,2002,2003
-function checkYear(year) {
- return year >= 2002;
- }
-years.find(checkYear); // Output: 2002
-
-// 6. findIndex()method
-var years = [2000, 2001, 2002, 2003];
-console.log(years); // Output : 2000,2001,2002,2003
-function checkYear(year) {
- return year >= 2002;
- }
-years.findIndex(checkYear); // Output: 2
-
-// 7.forEach() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-Country.forEach(countryFunction);
-function countryFunction(item) {
- console.log(item) // Output: India , Us , German , Australia
-}
-
-// 8. isArray() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-Array.isArray(Country); //Output: true
-
-// 9.includes() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-var avail = Country.includes("Australia");
-console.log(avail); // Output : true
-
-// 10. IndexOf() method
-var Country = ["India", "US", "German", "Australia"];
-console.log(Country); // Output : India , Us , German , Australia
-var iof = Country.indexOf("Australia");
-console.log(iof); // Output : 3
-
-
-// 11 map() method
-var numbers = [1,2,3,4,5];
-console.log(numbers); //[1,2,3,4,5]
-function double(num){
- return num * 2;
-}
-numbers = numbers.map(double);
-console.log(numbers); //[2,4,6,8,10]
diff --git a/JavaScript_Basics/arrays.js b/JavaScript_Basics/arrays.js
deleted file mode 100644
index 8567432..0000000
--- a/JavaScript_Basics/arrays.js
+++ /dev/null
@@ -1,46 +0,0 @@
-// Javascript arrays can take any values in the same array
-// We don't have to specify the size
-const a = ["hii", 26, "Swapnil"];
-
-console.log(a);
-// Output [ 'hii', 26, 'Swapnil' ]
-console.log(a.length); // This will print the size of array
-// Output 3
-
-const Student = []; // Created Empty array
-
-// Here we are pushing one by one element
-Student.push("Swapnil Satish Shinde"); // Pushed the Name
-
-Student.push(76); // Pushed rollno
-
-Student.push(true); // Pushed true
-
-console.log(Student); // Print Whole array
-// Output [ 'Swapnil Satish Shinde', 76, true ]
-
-const easyMethod = []; // Created Empty array
-
-easyMethod.push("Swapnil Satish Shinde", 76, true); // This way you can push Multiple Values at once.
-
-console.log(easyMethod);
-// Output [ 'Swapnil Satish Shinde', 76, true ]
-
-//The pop() method removes the last element from an array:
-var fruits = ["Banana", "Orange", "Apple", "Mango"];
-fruits.pop(); // Removes the last element ("Mango") from fruits and output is ["Banana","Orange","Apple"]
-
-//Shifting is equivalent to popping, working on the first element instead of the last.
-//The shift() method removes the first array element and "shifts" all other elements to a lower index.
-var cars = ["Acura", "Audi", "Bugatti", "Honda"];
-cars.shift(); // Removes the first element ("Acura") from cars and output is ["Audi","Bugatti","Honda"]
-
-//The length property provides an easy way to append a new element to an array:
-var mobiles = ["Apple", "Nokia", "Samsung", "Sony"];
-mobiles[mobiles.length] = "HTC"; // Appends "HTC" to mobiles and output is ["Apple", "Nokia", "Samsung", "Sony", "HTC"]
-
-//delete will delete the object property, but will not reindex the array or update its length. This makes it appears as if it is undefined:
-var myArray = ['a', 'b', 'c', 'd'];
-delete myArray[0];
-"The first value is: " + myArray[0]; //The first value is: undefined
-//Using delete may leave undefined holes in the array. Use pop() or shift() instead.
\ No newline at end of file
diff --git a/JavaScript_Basics/arrays.md b/JavaScript_Basics/arrays.md
deleted file mode 100644
index b7a58f7..0000000
--- a/JavaScript_Basics/arrays.md
+++ /dev/null
@@ -1,11 +0,0 @@
-# Arrays
-The push() method adds new items to the end of an array, and returns the new length.
-
-The pop() method removes the last element from an array.
-
-shift() is equivalent to popping, working on the first element instead of the last.
-
-length property provides an easy way to append a new element to an array.
-
-delete will delete the object property, but will not reindex the array or update its length. This makes it appears as if it is undefined.
-Using delete may leave undefined holes in the array. Use pop() or shift() instead.
\ No newline at end of file
diff --git a/JavaScript_Basics/boolean.js b/JavaScript_Basics/boolean.js
deleted file mode 100644
index 7a31f70..0000000
--- a/JavaScript_Basics/boolean.js
+++ /dev/null
@@ -1,6 +0,0 @@
-// JavaScript Boolean data type can store one of two values, true or false. ... e.g.
-const YES = new Boolean(true);
-
-// JavaScript treats an empty string (""), 0, undefined and null as false.
-
-// Everything else is true.
\ No newline at end of file
diff --git a/JavaScript_Basics/bugs.js b/JavaScript_Basics/bugs.js
deleted file mode 100644
index 3a5a90a..0000000
--- a/JavaScript_Basics/bugs.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var obj = {
- name: 'Some name'
-}
-
-var name = null;
-
-console.log(typeof obj) // object;
-console.log(typeof name) // object;
\ No newline at end of file
diff --git a/JavaScript_Basics/cookies.js b/JavaScript_Basics/cookies.js
deleted file mode 100644
index 5f5a3f2..0000000
--- a/JavaScript_Basics/cookies.js
+++ /dev/null
@@ -1,14 +0,0 @@
- // Redirect to landing page if 'form_submitted' cookie does not exist
-
- if (get_cookie('secondvisit') === null) {
- window.location.href = "landing.html";
- }
-
- //Here setTimeout() is a built-in JavaScript function which can be used to execute another function after a given time interval.
-
- function Redirect() {
- window.location = "https://www.tutorialspoint.com";
- }
-
- document.write("You will be redirected to main page in 10 sec.");
- setTimeout('Redirect()', 10000);
diff --git a/JavaScript_Basics/date.js b/JavaScript_Basics/date.js
deleted file mode 100644
index 4575670..0000000
--- a/JavaScript_Basics/date.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// The Date object in JavaScript is used to work with dates and times.
-
-const date = new Date(); // The date object initialization
-console.log(date); // current time and date in your local time zone
-
-const dateWithYear = new Date(2019, 10, 10, 22, 10, 0); // takes year, month, date, hour, minute, second, millisecond as arguments
-console.log(dateWithYear); //OUtput : Sun Nov 10 2019 22:10:00 GMT+0530
-
-const dateString = new Date("October 10, 2019 11:13:00");
-console.log(dateString); // Output : creates a new date object from date string
-
-const dateMilli = new Date(100000000000); // adds 100000000000 ms to 01 January 1970
-console.log(dateMilli); // approximately October 31 1966
-
-const isoDate = new Date("2019-10-10"); // The ISO 8601 syntax (YYYY-MM-DD)
-console.log(isoDate); // 2019-10-10
-
-const shortDate = new Date("03/25/2015"); // "MM/DD/YYYY" date format
-console.log(shortDate); // Thu Jan 01 1970 05:30:00 GMT+0530
-
-const longDate = new Date("Oct 10 2019"); // "MM DD YYYY" date format
-console.log(longDate); // Sun Oct 10 2010 00:00:00 GMT+0530
-
-// Date GET Methods
-date.getFullYear(); // 2019 (the year of a date as a four digit number)
-
-date.getMonth(); // 9 (month of a date as a number (0-11))
-
-date.getTime(); // 1570726799950 (the number of milliseconds since midnight Jan 1 1970, and a specified date)
-
-date.setFullYear(2020, 10, 3); // Set the date to November 3, 2020
-
-date.setMonth(4); // Set the month to 4 (May)
-
-date.setTime(1332403882588); // Thu Mar 22 2012 13:41:22 GMT+0530
\ No newline at end of file
diff --git a/JavaScript_Basics/domManipulation.js b/JavaScript_Basics/domManipulation.js
deleted file mode 100644
index 28d172f..0000000
--- a/JavaScript_Basics/domManipulation.js
+++ /dev/null
@@ -1,27 +0,0 @@
-// find first a element
-const element = document.querySelector('a');
-// find all DIVs, return it in a NodeList
-const allDivs= document.querySelector('div');
-// get the elements parent
-const parent = element.parentNode;
-// get the children of an element in a live HTMLCollection
-const children = parent.children;
-// notice that element should be amongs its parents choldren
-
-
-// creating a new
Hello World
-const node = document.createElement('p');
-node.textContent = 'Hello World,';
-// attaching it to the parent
-parent.appendChild(node);
-// and then removing it
-parent.removeChild(node);
-// or slef removing element
-element.remove();
-
-// manipulating style
-node.style.color = 'white';
-node.style.backgroundColor = 'black';
-node.style.padding = '10px';
-node.style.width = '250px';
-node.style.textAlign = 'center';
\ No newline at end of file
diff --git a/JavaScript_Basics/exercise-1-using-arrays.js b/JavaScript_Basics/exercise-1-using-arrays.js
deleted file mode 100644
index 99d8c9e..0000000
--- a/JavaScript_Basics/exercise-1-using-arrays.js
+++ /dev/null
@@ -1,23 +0,0 @@
-var array = [1, 0.16, "Random", function () {
- console.log("this is function in an array");
-}, { Key: "Answer" }, false];
-
-console.log("Array can contain anything");
-console.log(array);
-// add last
-array.push("add last");
-console.log(array);
-// remove last
-array.pop();
-console.log(array);
-// add first
-array.shift("add first");
-console.log(array);
-
-// remove first
-array.unshift();
-console.log(array);
-// this element is function
-array[2]();
-// object inside array
-console.log(array[3].Key);
\ No newline at end of file
diff --git a/JavaScript_Basics/exercise-1-using-classes.js b/JavaScript_Basics/exercise-1-using-classes.js
deleted file mode 100644
index 4866065..0000000
--- a/JavaScript_Basics/exercise-1-using-classes.js
+++ /dev/null
@@ -1,46 +0,0 @@
-class Student {
- // Created the constructor for student
- constructor (firstName, lastName, age, college, bio) {
- this.firstName = firstName;
- this.lastName = lastName;
- this.age = age;
- this.college = college;
- this.bio = bio;
- }
-
- // This method returns combined firstname and lastname
- getFullName () {
- return (`${this.firstName} ${this.lastName}`);
- }
-
- // This method returns bio
- getBio () {
- return (`${this.bio}`);
- }
-
- // This method returns All details
- getAllDetails () {
- return (`My name is ${this.firstName} ${this.lastName} \nMy age is ${this.age} \nMy college is ${this.college}, I am ${this.bio}.`);
- }
-}
-
-const Swapnil = new Student("Swapnil", "Shinde", 19, "SIES", "Web Developer"); // Created object with arguments
-
-console.log(Swapnil.getFullName()); // Output Swapnil Shinde
-
-console.log(Swapnil.getBio()); // Output Web Developer
-
-console.log(Swapnil.getAllDetails()); // Output My name is Swapnil Shinde. My age is 19. My college is SIES, I am Web Developer.
-
-console.log(Swapnil); // This returns the object only
-/*
- Output
-
-Student {
- firstName: 'Swapnil',
- lastName: 'Shinde',
- age: 19,
- college: 'SIES',
- bio: 'Web Developer'
-}
-*/
\ No newline at end of file
diff --git a/JavaScript_Basics/exercise-1-using-object.js b/JavaScript_Basics/exercise-1-using-object.js
deleted file mode 100644
index e400518..0000000
--- a/JavaScript_Basics/exercise-1-using-object.js
+++ /dev/null
@@ -1,25 +0,0 @@
-const student = {
- firstName: "Swapnil",
- lastName: "Shinde",
- age: 19,
- college: "SIES",
- bio: "Web developer"
-};
-
-getFullName = () => {
- return `${student.firstName} ${student.lastName}`;
-};
-
-getBio = () => {
- return student.bio;
-};
-
-getAllDetails = () => {
- return `My name is ${student.firstName} ${student.lastName} \nMy age is ${student.age} \nMy college is ${student.college}, I am ${student.bio}.`;
-};
-
-console.log(getFullName()); // Output Swapnil Shinde
-
-console.log(getBio()); // Output Web developer
-
-console.log(getAllDetails()); // Output My name is Swapnil Shinde. My age is 19. My college is SIES, I am Web developer.
\ No newline at end of file
diff --git a/JavaScript_Basics/filter.js b/JavaScript_Basics/filter.js
deleted file mode 100644
index 23a4e45..0000000
--- a/JavaScript_Basics/filter.js
+++ /dev/null
@@ -1,25 +0,0 @@
-//JavaScript Array filter() Method
-
-/*The filter() method creates a new array with all elements that
-pass the test implemented by the provided function.
-*/
-
-let words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
-
-const result = words.filter(word => word.length > 6);
-
-console.log(result);
-
-// expected output: Array ["exuberant", "destruction", "present"]
-/*
-Another example
-Filtering out all small values
-The following example uses filter() to create a filtered array that has all elements
-with values less than 10 removed.
-*/
-function isBigEnough(value) {
- return value >= 10;
-}
-
-var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
-// filtered is [12, 130, 44]
diff --git a/JavaScript_Basics/forEach.js b/JavaScript_Basics/forEach.js
deleted file mode 100644
index 54cc833..0000000
--- a/JavaScript_Basics/forEach.js
+++ /dev/null
@@ -1,11 +0,0 @@
-//Map.forEach method in JavaScript
-/*The forEach() method executes a provided function once per each
-key/value pair in the Map object, in insertion order.*/
-function logMapElements(value, key, map) {
- console.log(`map.get('${key}') = ${value}`);
-}
-new Map([['foo', 3], ['bar', {}], ['baz', undefined]]).forEach(logMapElements);
-// logs:
-// "map.get('foo') = 3"
-// "map.get('bar') = [object Object]"
-// "map.get('baz') = undefined"
\ No newline at end of file
diff --git a/JavaScript_Basics/functions.js b/JavaScript_Basics/functions.js
deleted file mode 100644
index b33d997..0000000
--- a/JavaScript_Basics/functions.js
+++ /dev/null
@@ -1,40 +0,0 @@
-function helpGST () { // This way you can write functions in JS
- // There is no requirement of specifying the return type of function
- console.log("Hii GST");
-}
-// Function is written to do a specific task many types in program.
-// This increases the maintainability and decreases the repetition of same code.
-helpGST(); // For executing we have to call that function
-
-function Add (a, b) { // Here We have taken 2 Arguments a and b
- const c = a + b;
- return c; // This returns the result
-}
-
-console.log(Add(10, 5)); // This Calls the function
-// We have to directly pass the arguments in function call
-
-// Functions can have a default parameter value.
-// Default value will be used if the argument is not defined.
-function subtract(a, b = 1) {
- const c = a - b;
- return c;
-}
-
-console.log(subtract(5)); // Output 4.
-console.log(subtract(5, 3)); // Output 2.
-console.log(subtract(5, null)); // Output 5, because null is a valid value.
-
-// Functions which don't have name are called Anonymous this should be assigned to a particular variable
-const helpFast = function () {
- return ("Fast Fast");
-};
-console.log(helpFast());
-// Output Fast Fast
-
-const helpVeryFast = () => {
- return ("Very Fast");
-};
-
-console.log(helpVeryFast());
-// Output Very Fast
\ No newline at end of file
diff --git a/JavaScript_Basics/if.js b/JavaScript_Basics/if.js
deleted file mode 100644
index cc6c805..0000000
--- a/JavaScript_Basics/if.js
+++ /dev/null
@@ -1,32 +0,0 @@
-// IF keyword condition
-// this is used to create condition block of code
-
-// the if needs a condition that the result is true and execute the
-// code inside of the if block
-
-const condition = 2 % 2 === 0
-
-if (condition) {
- // run this code
- console.log('YEAH THIS RUN BECAUSE THE CONDITION IS A HARDCODE true')
-}
-
-// have a default value if the condition is false
-// this runs in the else code block
-
-if (condition) {
- // this block of code is never executed
-} else {
- // run this code
- console.log('YEAH THIS RUN BECAUSE THE CONDITION IS A HARDCODE false')
-}
-
-// and you can make more conditions with an ELSE IF keyword
-
-if (!condition) {
- // this block of code is never executed
-} else if (condition) {
- // this code is executed because 1 is true like binary
-} else {
- // this block of code is never executed
-}
diff --git a/JavaScript_Basics/inheritance.js b/JavaScript_Basics/inheritance.js
deleted file mode 100644
index f88e0e9..0000000
--- a/JavaScript_Basics/inheritance.js
+++ /dev/null
@@ -1,35 +0,0 @@
-// common functions are combined in a class to have less repetition in code
-
-class Animals { // Animal class is created where the legs are defined 4
- constructor () {
- this.legs = 4;
- }
-
- getLegs () { // Function for getting legs
- return (this.legs);
- }
-}
-
-class Dog extends Animals {
- constructor (age) {
- super(); // As We have to also call the constructor of Animals if constructor is empty this automatically calls the super
- this.age = age;
- }
-
- // we have inherited the animals so getLegs method is also there in Dog class
- getSound () {
- return ("Bhow");
- }
-
- getAge () {
- return (this.age);
- }
-}
-
-const tommy = new Dog(10); // Created Object of Dog class
-
-console.log(tommy.getLegs()); // Output 4
-
-console.log(tommy.getSound()); // Bhow
-
-console.log(tommy.getAge()); // 10
\ No newline at end of file
diff --git a/JavaScript_Basics/map.js b/JavaScript_Basics/map.js
deleted file mode 100644
index 8c933cb..0000000
--- a/JavaScript_Basics/map.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// Let's create an array of numbers that we want to get the square of each number in the array
-var numbers = [1, 2, 3, 4, 5];
-
-// pass a function to map
-const square = numbers.map(function (num) {
- return num * num;
-});
-
-// You can also do this using an arrow function
-const square2 = numbers.map(num => num * num);
-
-console.log(square);
-// expected output: Array [1, 4, 9, 16, 25]
-
-console.log(square2);
-// expected output: Array [1, 4, 9, 16, 25]
\ No newline at end of file
diff --git a/JavaScript_Basics/objects.js b/JavaScript_Basics/objects.js
deleted file mode 100644
index f235052..0000000
--- a/JavaScript_Basics/objects.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// Object in basically collection of key value pairs
-const old = {
- name: "Swapnil", // left is key and right one is value
- rollno: 76 // We assign any type to keys
-};
-
-console.log(old);
-// Output { name: 'Swapnil', rollno: 76 }
-
-const a = {
- name: "Swapnil", // We can omit the " " in keys but for string values it is necessary
- rollno: 76 // We assign any type to keys
-};
-
-console.log(a);
-// Output { name: 'Swapnil', rollno: 76 }
-
-const b = {
- name: "Swapnil",
- rollno: 76,
- rollno: "Swap" // If we repeat the same key then the latest value is stored
-};
-
-console.log(b);
-// Output { name: 'Swapnil', rollno: 'Swap' }
-
-console.log(a.name); // This way we can get a particular value for a key. " " around are imp.
-
-console.log(a.name); // This way you can get the value of particular element
-// Output Swapnil
-a.name = "Swapnil Satish Shinde"; // This way we can change a particular property of object
-
-console.log(a.name); // This way you can get the value of particular element
-// Output Swapnil Satish Shinde
-
-console.log(a);
-// Output { name: 'Swapnil Satish Shinde', rollno: 76 }
-
-const objectWithFunction = {
- name: "Swapnil", // We can omit the " " in keys but for string values it is necessary
- rollno: 76, // We assign any type to keys
- getfull: function () { // Don't use arrow function here as arrow functions don't have this property
- console.log(`${this.name} ${this.rollno}`);
- }
-};
-
-console.log(objectWithFunction);
-// Output { name: 'Swapnil', rollno: 76, getfull: [Function: getfull] }
-
-objectWithFunction.getfull(); // Output Swapnil 76
-
-const canAddValue = { // This is normal object having 2 keys name and rollno
- name: "Swapnil",
- rollno: 76
-};
-
-// We can add the keys we want any time into the object by directly assigning value to it
-canAddValue.branch = "Computer";
-
-console.log(canAddValue);
-// Output { name: 'Swapnil', rollno: 76, branch: 'Computer' }
\ No newline at end of file
diff --git a/JavaScript_Basics/page-redirects.js b/JavaScript_Basics/page-redirects.js
deleted file mode 100644
index c329399..0000000
--- a/JavaScript_Basics/page-redirects.js
+++ /dev/null
@@ -1,62 +0,0 @@
-/**
- *
- * JAVASCRIPT PAGE REDIRECTS
- * The file shows various usages of JS methods to facilitate the Page Redirects
- * There are two techniques that are listed here.
- * i) General JS Page redirects
- * ii) Auto-refresh of the HTML Pages
- *
- */
-
-// Using the window.location assigned with a DOMString (URL)
-window.location = 'https://www.example.com';
-
-// Using the href property of the Location object
-window.location.href = 'https://www.example.com';
-
-// Using the window.location.assign() method
-window.location.assign('https://www.example.com');
-
-// Using the window.location.replace() method
-window.location.replace('https://www.example.com');
-
-///////////////////////////////////////////////////////////////////
-//// Auto-Refresh ///
-///////////////////////////////////////////////////////////////////
-
-// Using the window.location.reload(forcedReload) method
-// The optional parameter forcedReload accepts a boolean value
-// If it is set to true, the page is downloaded from the server
-// If the value is false, the page is reloaded from cache
-
-// The following code demonstrates the auto-refresh
-function autoRefresh(intervalInMilliSeconds) {
- // Using setTimeout()
- setTimeout(window.location.reload(), intervalInMilliSeconds);
-
- /******* OR *******/
-
- // Using setInterval()
- setInterval(window.location.reload(), intervalInMilliSeconds);
-}
-// Run the function onload of the page
-autoRefresh();
-
- /******* OR *******/
-
-
-//A redirect is when a web page is visited at a certain URL, it changes to a different URL.
-//This can be done for many reasons like moving your domain to a new one or You have built-up various pages based on browser versions or their names or may be based on different countries.
-//Most popular way to redirect to another webpage using JavaScript is location.href and location.replace
-
-function Redirect() {
- window.location = "https://www.google.com";
- }
-
- //For an auto refresh you would use the following script
-
- function AutoRefresh( t ) {
- setTimeout("location.reload(true);", t);
- }
-
- //Please look at the page-redirect.md file to see where you would include these scripts
\ No newline at end of file
diff --git a/JavaScript_Basics/reduce.js b/JavaScript_Basics/reduce.js
deleted file mode 100644
index de34288..0000000
--- a/JavaScript_Basics/reduce.js
+++ /dev/null
@@ -1,15 +0,0 @@
-//JavaScript | Array reduce() Method
-/*
-The array reduce() method in JavaScript is used to reduce
-the array to a single value and executes a provided function
-for each value of the array (from left-to-right) and the return
-value of the function is stored in an accumulator.
-*/
-var pokemon = ["squirtle", "charmander", "bulbasaur"];
-
-var pokeLength =
- pokemon.reduce(function(previous, current) {
- return previous + current.length;
- }, 0);
-
-// Outputs 27
\ No newline at end of file
diff --git a/JavaScript_Basics/some.js b/JavaScript_Basics/some.js
deleted file mode 100644
index 49d183a..0000000
--- a/JavaScript_Basics/some.js
+++ /dev/null
@@ -1,30 +0,0 @@
-//JavaScript | some() Method
-/*
-some() method in JavaScript is used to check if leasts one element of the set meets the condition implemented by
-determinated function
-*/
-
-const array = [
- {
- id: 1,
- name: 'John'
- },
- {
- id: 2,
- name: 'David'
- },
- {
- id: 3,
- name: 'Lisa'
- },
- {
- id: 4,
- name: 'Ashley'
- }
-];
-
-const existAshley = array.some(element => element.name === 'Ashley');
-
-// The const existAshley return true or false if the condition is correct
-
-// In this example the const existAshley return true
diff --git a/JavaScript_Basics/swithcase.js b/JavaScript_Basics/swithcase.js
deleted file mode 100644
index 0a4c49b..0000000
--- a/JavaScript_Basics/swithcase.js
+++ /dev/null
@@ -1,185 +0,0 @@
-/**
- * 1. Where we use the Switch
- * 2. More info about Switch
- */
-
-// 1. Where we use the Switch
-
-// The switch statement is used to perform different actions based on different conditions.
-
-// The JavaScript Switch Statement
-// Use the switch statement to select one of many code blocks to be executed.
-
-Syntax
-switch(expression) {
- case x:
- // code block
- break;
- case y:
- // code block
- break;
- default:
- // code block
-}
-
-// This is how it works:
-
-// The switch expression is evaluated once.
-// The value of the expression is compared with the values of each case.
-// If there is a match, the associated block of code is executed.
-// Example
-// The getDay() method returns the weekday as a number between 0 and 6.
-
-// (Sunday=0, Monday=1, Tuesday=2 ..)
-
-// This example uses the weekday number to calculate the weekday name:
-
-switch (new Date().getDay()) {
- case 0:
- day = "Sunday";
- break;
- case 1:
- day = "Monday";
- break;
- case 2:
- day = "Tuesday";
- break;
- case 3:
- day = "Wednesday";
- break;
- case 4:
- day = "Thursday";
- break;
- case 5:
- day = "Friday";
- break;
- case 6:
- day = "Saturday";
-}
-
-/**
- * The result of day will be:Thursday
- */
-
-
-
-// 2. More info about Switch
-
-
-// The break Keyword
-// When JavaScript reaches a break keyword, it breaks out of the switch block.
-
-// This will stop the execution of inside the block.
-
-// It is not necessary to break the last case in a switch block. The block breaks (ends) there anyway.
-
-// Note: If you omit the break statement, the next case will be executed even if the evaluation does not match the case.
-
-// The default Keyword
-// The default keyword specifies the code to run if there is no case match:
-
-// Example
-// The getDay() method returns the weekday as a number between 0 and 6.
-
-// If today is neither Saturday (6) nor Sunday (0), write a default message:
-
-switch (new Date().getDay()) {
- case 6:
- text = "Today is Saturday";
- break;
- case 0:
- text = "Today is Sunday";
- break;
- default:
- text = "Looking forward to the Weekend";
- }
-
- // The result of text will be:
-
- // Looking forward to the Weekend
- // The default case does not have to be the last case in a switch block:
-
-
- //Example
-
- switch (new Date().getDay()) {
- default:
- text = "Looking forward to the Weekend";
- break;
- case 6:
- text = "Today is Saturday";
- break;
- case 0:
- text = "Today is Sunday";
- }
-
-
- // If default is not the last case in the switch block, remember to end the default case with a break.
-
- // Common Code Blocks
- // Sometimes you will want different switch cases to use the same code.
-
- // In this example case 4 and 5 share the same code block, and 0 and 6 share another code block:
-
-
- // Example
-
- switch (new Date().getDay()) {
- case 4:
- case 5:
- text = "Soon it is Weekend";
- break;
- case 0:
- case 6:
- text = "It is Weekend";
- break;
- default:
- text = "Looking forward to the Weekend";
- }
-
-
- // Switching Details
- // If multiple cases matches a case value, the first case is selected.
-
- // If no matching cases are found, the program continues to the default label.
-
- // If no default label is found, the program continues to the statement(s) after the switch.
-
- // Strict Comparison
- // Switch cases use strict comparison (===).
-
- // The values must be of the same type to match.
-
- // A strict comparison can only be true if the operands are of the same type.
-
- // In this example there will be no match for x:
-
- Example
- var x = "0";
- switch (x) {
- case 0:
- text = "Off";
- break;
- case 1:
- text = "On";
- break;
- default:
- text = "No value found";
- }
-
-
-/** Exercise for You Complete it */
-
-// Create a switch statement that will alert "Hello" if fruits is "banana", and "Welcome" if fruits is "apple".
-
-switch (fruits) {
-
- case "Banana":
- alert("Hello")
- break;
-
- case "Apple":
- alert("Welcome")
- break;
-}
-
\ No newline at end of file
diff --git a/JavaScript_Basics/this.js b/JavaScript_Basics/this.js
deleted file mode 100644
index 208ed19..0000000
--- a/JavaScript_Basics/this.js
+++ /dev/null
@@ -1,31 +0,0 @@
-console.log(this); // This gives empty object
-// Output {}
-
-var aa = 1;
-console.log(global.aa); // Global scope is accessible to every where
-// Output undefined
-
-// Nodejs has Global object which is accessible in all file it has some predefined functions
-
-// Blocked Objects
-{
- var a = 1;
- const b = 2;
- console.log(b);
-}
-console.log(a);// Output 1 as variable a is declared using var
-console.log(a);
-
-// console.log(b) // Output ReferenceError: b is not defined as b is defined using let it is going to be declared only in that block
-
-const help = () => {
- var a = 4;
- const b = 2; // variables defined by let and const are accessible to there scope only
- console.log(a); // This will not get printed unless and until function is called
-};
-
-console.log(a);// Output 1
-
-// console.log(b); // Output ReferenceError: b is not defined as b is in function scope only
-
-help(); // Output 4
\ No newline at end of file
diff --git a/JavaScript_Basics/variables.js b/JavaScript_Basics/variables.js
deleted file mode 100644
index a7486fe..0000000
--- a/JavaScript_Basics/variables.js
+++ /dev/null
@@ -1,7 +0,0 @@
-// There is only 3 types of variables in javascript
-
-let a = "Swapnil"; // New type introduced in ES6. Value of let can change any time.
-
-const pi = 3.14;// New type introduced in ES6. Value of pi now cannot be changed as this is defined as const.
-
-var b = 26;// This is Deprecated as this creates many problems in future.
\ No newline at end of file
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..0ad25db
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,661 @@
+ GNU AFFERO GENERAL PUBLIC LICENSE
+ Version 3, 19 November 2007
+
+ Copyright (C) 2007 Free Software Foundation, Inc.
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+ Preamble
+
+ The GNU Affero General Public License is a free, copyleft license for
+software and other kinds of works, specifically designed to ensure
+cooperation with the community in the case of network server software.
+
+ The licenses for most software and other practical works are designed
+to take away your freedom to share and change the works. By contrast,
+our General Public Licenses are intended to guarantee your freedom to
+share and change all versions of a program--to make sure it remains free
+software for all its users.
+
+ When we speak of free software, we are referring to freedom, not
+price. Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+them if you wish), that you receive source code or can get it if you
+want it, that you can change the software or use pieces of it in new
+free programs, and that you know you can do these things.
+
+ Developers that use our General Public Licenses protect your rights
+with two steps: (1) assert copyright on the software, and (2) offer
+you this License which gives you legal permission to copy, distribute
+and/or modify the software.
+
+ A secondary benefit of defending all users' freedom is that
+improvements made in alternate versions of the program, if they
+receive widespread use, become available for other developers to
+incorporate. Many developers of free software are heartened and
+encouraged by the resulting cooperation. However, in the case of
+software used on network servers, this result may fail to come about.
+The GNU General Public License permits making a modified version and
+letting the public access it on a server without ever releasing its
+source code to the public.
+
+ The GNU Affero General Public License is designed specifically to
+ensure that, in such cases, the modified source code becomes available
+to the community. It requires the operator of a network server to
+provide the source code of the modified version running there to the
+users of that server. Therefore, public use of a modified version, on
+a publicly accessible server, gives the public access to the source
+code of the modified version.
+
+ An older license, called the Affero General Public License and
+published by Affero, was designed to accomplish similar goals. This is
+a different license, not a version of the Affero GPL, but Affero has
+released a new version of the Affero GPL which permits relicensing under
+this license.
+
+ The precise terms and conditions for copying, distribution and
+modification follow.
+
+ TERMS AND CONDITIONS
+
+ 0. Definitions.
+
+ "This License" refers to version 3 of the GNU Affero General Public License.
+
+ "Copyright" also means copyright-like laws that apply to other kinds of
+works, such as semiconductor masks.
+
+ "The Program" refers to any copyrightable work licensed under this
+License. Each licensee is addressed as "you". "Licensees" and
+"recipients" may be individuals or organizations.
+
+ To "modify" a work means to copy from or adapt all or part of the work
+in a fashion requiring copyright permission, other than the making of an
+exact copy. The resulting work is called a "modified version" of the
+earlier work or a work "based on" the earlier work.
+
+ A "covered work" means either the unmodified Program or a work based
+on the Program.
+
+ To "propagate" a work means to do anything with it that, without
+permission, would make you directly or secondarily liable for
+infringement under applicable copyright law, except executing it on a
+computer or modifying a private copy. Propagation includes copying,
+distribution (with or without modification), making available to the
+public, and in some countries other activities as well.
+
+ To "convey" a work means any kind of propagation that enables other
+parties to make or receive copies. Mere interaction with a user through
+a computer network, with no transfer of a copy, is not conveying.
+
+ An interactive user interface displays "Appropriate Legal Notices"
+to the extent that it includes a convenient and prominently visible
+feature that (1) displays an appropriate copyright notice, and (2)
+tells the user that there is no warranty for the work (except to the
+extent that warranties are provided), that licensees may convey the
+work under this License, and how to view a copy of this License. If
+the interface presents a list of user commands or options, such as a
+menu, a prominent item in the list meets this criterion.
+
+ 1. Source Code.
+
+ The "source code" for a work means the preferred form of the work
+for making modifications to it. "Object code" means any non-source
+form of a work.
+
+ A "Standard Interface" means an interface that either is an official
+standard defined by a recognized standards body, or, in the case of
+interfaces specified for a particular programming language, one that
+is widely used among developers working in that language.
+
+ The "System Libraries" of an executable work include anything, other
+than the work as a whole, that (a) is included in the normal form of
+packaging a Major Component, but which is not part of that Major
+Component, and (b) serves only to enable use of the work with that
+Major Component, or to implement a Standard Interface for which an
+implementation is available to the public in source code form. A
+"Major Component", in this context, means a major essential component
+(kernel, window system, and so on) of the specific operating system
+(if any) on which the executable work runs, or a compiler used to
+produce the work, or an object code interpreter used to run it.
+
+ The "Corresponding Source" for a work in object code form means all
+the source code needed to generate, install, and (for an executable
+work) run the object code and to modify the work, including scripts to
+control those activities. However, it does not include the work's
+System Libraries, or general-purpose tools or generally available free
+programs which are used unmodified in performing those activities but
+which are not part of the work. For example, Corresponding Source
+includes interface definition files associated with source files for
+the work, and the source code for shared libraries and dynamically
+linked subprograms that the work is specifically designed to require,
+such as by intimate data communication or control flow between those
+subprograms and other parts of the work.
+
+ The Corresponding Source need not include anything that users
+can regenerate automatically from other parts of the Corresponding
+Source.
+
+ The Corresponding Source for a work in source code form is that
+same work.
+
+ 2. Basic Permissions.
+
+ All rights granted under this License are granted for the term of
+copyright on the Program, and are irrevocable provided the stated
+conditions are met. This License explicitly affirms your unlimited
+permission to run the unmodified Program. The output from running a
+covered work is covered by this License only if the output, given its
+content, constitutes a covered work. This License acknowledges your
+rights of fair use or other equivalent, as provided by copyright law.
+
+ You may make, run and propagate covered works that you do not
+convey, without conditions so long as your license otherwise remains
+in force. You may convey covered works to others for the sole purpose
+of having them make modifications exclusively for you, or provide you
+with facilities for running those works, provided that you comply with
+the terms of this License in conveying all material for which you do
+not control copyright. Those thus making or running the covered works
+for you must do so exclusively on your behalf, under your direction
+and control, on terms that prohibit them from making any copies of
+your copyrighted material outside their relationship with you.
+
+ Conveying under any other circumstances is permitted solely under
+the conditions stated below. Sublicensing is not allowed; section 10
+makes it unnecessary.
+
+ 3. Protecting Users' Legal Rights From Anti-Circumvention Law.
+
+ No covered work shall be deemed part of an effective technological
+measure under any applicable law fulfilling obligations under article
+11 of the WIPO copyright treaty adopted on 20 December 1996, or
+similar laws prohibiting or restricting circumvention of such
+measures.
+
+ When you convey a covered work, you waive any legal power to forbid
+circumvention of technological measures to the extent such circumvention
+is effected by exercising rights under this License with respect to
+the covered work, and you disclaim any intention to limit operation or
+modification of the work as a means of enforcing, against the work's
+users, your or third parties' legal rights to forbid circumvention of
+technological measures.
+
+ 4. Conveying Verbatim Copies.
+
+ You may convey verbatim copies of the Program's source code as you
+receive it, in any medium, provided that you conspicuously and
+appropriately publish on each copy an appropriate copyright notice;
+keep intact all notices stating that this License and any
+non-permissive terms added in accord with section 7 apply to the code;
+keep intact all notices of the absence of any warranty; and give all
+recipients a copy of this License along with the Program.
+
+ You may charge any price or no price for each copy that you convey,
+and you may offer support or warranty protection for a fee.
+
+ 5. Conveying Modified Source Versions.
+
+ You may convey a work based on the Program, or the modifications to
+produce it from the Program, in the form of source code under the
+terms of section 4, provided that you also meet all of these conditions:
+
+ a) The work must carry prominent notices stating that you modified
+ it, and giving a relevant date.
+
+ b) The work must carry prominent notices stating that it is
+ released under this License and any conditions added under section
+ 7. This requirement modifies the requirement in section 4 to
+ "keep intact all notices".
+
+ c) You must license the entire work, as a whole, under this
+ License to anyone who comes into possession of a copy. This
+ License will therefore apply, along with any applicable section 7
+ additional terms, to the whole of the work, and all its parts,
+ regardless of how they are packaged. This License gives no
+ permission to license the work in any other way, but it does not
+ invalidate such permission if you have separately received it.
+
+ d) If the work has interactive user interfaces, each must display
+ Appropriate Legal Notices; however, if the Program has interactive
+ interfaces that do not display Appropriate Legal Notices, your
+ work need not make them do so.
+
+ A compilation of a covered work with other separate and independent
+works, which are not by their nature extensions of the covered work,
+and which are not combined with it such as to form a larger program,
+in or on a volume of a storage or distribution medium, is called an
+"aggregate" if the compilation and its resulting copyright are not
+used to limit the access or legal rights of the compilation's users
+beyond what the individual works permit. Inclusion of a covered work
+in an aggregate does not cause this License to apply to the other
+parts of the aggregate.
+
+ 6. Conveying Non-Source Forms.
+
+ You may convey a covered work in object code form under the terms
+of sections 4 and 5, provided that you also convey the
+machine-readable Corresponding Source under the terms of this License,
+in one of these ways:
+
+ a) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by the
+ Corresponding Source fixed on a durable physical medium
+ customarily used for software interchange.
+
+ b) Convey the object code in, or embodied in, a physical product
+ (including a physical distribution medium), accompanied by a
+ written offer, valid for at least three years and valid for as
+ long as you offer spare parts or customer support for that product
+ model, to give anyone who possesses the object code either (1) a
+ copy of the Corresponding Source for all the software in the
+ product that is covered by this License, on a durable physical
+ medium customarily used for software interchange, for a price no
+ more than your reasonable cost of physically performing this
+ conveying of source, or (2) access to copy the
+ Corresponding Source from a network server at no charge.
+
+ c) Convey individual copies of the object code with a copy of the
+ written offer to provide the Corresponding Source. This
+ alternative is allowed only occasionally and noncommercially, and
+ only if you received the object code with such an offer, in accord
+ with subsection 6b.
+
+ d) Convey the object code by offering access from a designated
+ place (gratis or for a charge), and offer equivalent access to the
+ Corresponding Source in the same way through the same place at no
+ further charge. You need not require recipients to copy the
+ Corresponding Source along with the object code. If the place to
+ copy the object code is a network server, the Corresponding Source
+ may be on a different server (operated by you or a third party)
+ that supports equivalent copying facilities, provided you maintain
+ clear directions next to the object code saying where to find the
+ Corresponding Source. Regardless of what server hosts the
+ Corresponding Source, you remain obligated to ensure that it is
+ available for as long as needed to satisfy these requirements.
+
+ e) Convey the object code using peer-to-peer transmission, provided
+ you inform other peers where the object code and Corresponding
+ Source of the work are being offered to the general public at no
+ charge under subsection 6d.
+
+ A separable portion of the object code, whose source code is excluded
+from the Corresponding Source as a System Library, need not be
+included in conveying the object code work.
+
+ A "User Product" is either (1) a "consumer product", which means any
+tangible personal property which is normally used for personal, family,
+or household purposes, or (2) anything designed or sold for incorporation
+into a dwelling. In determining whether a product is a consumer product,
+doubtful cases shall be resolved in favor of coverage. For a particular
+product received by a particular user, "normally used" refers to a
+typical or common use of that class of product, regardless of the status
+of the particular user or of the way in which the particular user
+actually uses, or expects or is expected to use, the product. A product
+is a consumer product regardless of whether the product has substantial
+commercial, industrial or non-consumer uses, unless such uses represent
+the only significant mode of use of the product.
+
+ "Installation Information" for a User Product means any methods,
+procedures, authorization keys, or other information required to install
+and execute modified versions of a covered work in that User Product from
+a modified version of its Corresponding Source. The information must
+suffice to ensure that the continued functioning of the modified object
+code is in no case prevented or interfered with solely because
+modification has been made.
+
+ If you convey an object code work under this section in, or with, or
+specifically for use in, a User Product, and the conveying occurs as
+part of a transaction in which the right of possession and use of the
+User Product is transferred to the recipient in perpetuity or for a
+fixed term (regardless of how the transaction is characterized), the
+Corresponding Source conveyed under this section must be accompanied
+by the Installation Information. But this requirement does not apply
+if neither you nor any third party retains the ability to install
+modified object code on the User Product (for example, the work has
+been installed in ROM).
+
+ The requirement to provide Installation Information does not include a
+requirement to continue to provide support service, warranty, or updates
+for a work that has been modified or installed by the recipient, or for
+the User Product in which it has been modified or installed. Access to a
+network may be denied when the modification itself materially and
+adversely affects the operation of the network or violates the rules and
+protocols for communication across the network.
+
+ Corresponding Source conveyed, and Installation Information provided,
+in accord with this section must be in a format that is publicly
+documented (and with an implementation available to the public in
+source code form), and must require no special password or key for
+unpacking, reading or copying.
+
+ 7. Additional Terms.
+
+ "Additional permissions" are terms that supplement the terms of this
+License by making exceptions from one or more of its conditions.
+Additional permissions that are applicable to the entire Program shall
+be treated as though they were included in this License, to the extent
+that they are valid under applicable law. If additional permissions
+apply only to part of the Program, that part may be used separately
+under those permissions, but the entire Program remains governed by
+this License without regard to the additional permissions.
+
+ When you convey a copy of a covered work, you may at your option
+remove any additional permissions from that copy, or from any part of
+it. (Additional permissions may be written to require their own
+removal in certain cases when you modify the work.) You may place
+additional permissions on material, added by you to a covered work,
+for which you have or can give appropriate copyright permission.
+
+ Notwithstanding any other provision of this License, for material you
+add to a covered work, you may (if authorized by the copyright holders of
+that material) supplement the terms of this License with terms:
+
+ a) Disclaiming warranty or limiting liability differently from the
+ terms of sections 15 and 16 of this License; or
+
+ b) Requiring preservation of specified reasonable legal notices or
+ author attributions in that material or in the Appropriate Legal
+ Notices displayed by works containing it; or
+
+ c) Prohibiting misrepresentation of the origin of that material, or
+ requiring that modified versions of such material be marked in
+ reasonable ways as different from the original version; or
+
+ d) Limiting the use for publicity purposes of names of licensors or
+ authors of the material; or
+
+ e) Declining to grant rights under trademark law for use of some
+ trade names, trademarks, or service marks; or
+
+ f) Requiring indemnification of licensors and authors of that
+ material by anyone who conveys the material (or modified versions of
+ it) with contractual assumptions of liability to the recipient, for
+ any liability that these contractual assumptions directly impose on
+ those licensors and authors.
+
+ All other non-permissive additional terms are considered "further
+restrictions" within the meaning of section 10. If the Program as you
+received it, or any part of it, contains a notice stating that it is
+governed by this License along with a term that is a further
+restriction, you may remove that term. If a license document contains
+a further restriction but permits relicensing or conveying under this
+License, you may add to a covered work material governed by the terms
+of that license document, provided that the further restriction does
+not survive such relicensing or conveying.
+
+ If you add terms to a covered work in accord with this section, you
+must place, in the relevant source files, a statement of the
+additional terms that apply to those files, or a notice indicating
+where to find the applicable terms.
+
+ Additional terms, permissive or non-permissive, may be stated in the
+form of a separately written license, or stated as exceptions;
+the above requirements apply either way.
+
+ 8. Termination.
+
+ You may not propagate or modify a covered work except as expressly
+provided under this License. Any attempt otherwise to propagate or
+modify it is void, and will automatically terminate your rights under
+this License (including any patent licenses granted under the third
+paragraph of section 11).
+
+ However, if you cease all violation of this License, then your
+license from a particular copyright holder is reinstated (a)
+provisionally, unless and until the copyright holder explicitly and
+finally terminates your license, and (b) permanently, if the copyright
+holder fails to notify you of the violation by some reasonable means
+prior to 60 days after the cessation.
+
+ Moreover, your license from a particular copyright holder is
+reinstated permanently if the copyright holder notifies you of the
+violation by some reasonable means, this is the first time you have
+received notice of violation of this License (for any work) from that
+copyright holder, and you cure the violation prior to 30 days after
+your receipt of the notice.
+
+ Termination of your rights under this section does not terminate the
+licenses of parties who have received copies or rights from you under
+this License. If your rights have been terminated and not permanently
+reinstated, you do not qualify to receive new licenses for the same
+material under section 10.
+
+ 9. Acceptance Not Required for Having Copies.
+
+ You are not required to accept this License in order to receive or
+run a copy of the Program. Ancillary propagation of a covered work
+occurring solely as a consequence of using peer-to-peer transmission
+to receive a copy likewise does not require acceptance. However,
+nothing other than this License grants you permission to propagate or
+modify any covered work. These actions infringe copyright if you do
+not accept this License. Therefore, by modifying or propagating a
+covered work, you indicate your acceptance of this License to do so.
+
+ 10. Automatic Licensing of Downstream Recipients.
+
+ Each time you convey a covered work, the recipient automatically
+receives a license from the original licensors, to run, modify and
+propagate that work, subject to this License. You are not responsible
+for enforcing compliance by third parties with this License.
+
+ An "entity transaction" is a transaction transferring control of an
+organization, or substantially all assets of one, or subdividing an
+organization, or merging organizations. If propagation of a covered
+work results from an entity transaction, each party to that
+transaction who receives a copy of the work also receives whatever
+licenses to the work the party's predecessor in interest had or could
+give under the previous paragraph, plus a right to possession of the
+Corresponding Source of the work from the predecessor in interest, if
+the predecessor has it or can get it with reasonable efforts.
+
+ You may not impose any further restrictions on the exercise of the
+rights granted or affirmed under this License. For example, you may
+not impose a license fee, royalty, or other charge for exercise of
+rights granted under this License, and you may not initiate litigation
+(including a cross-claim or counterclaim in a lawsuit) alleging that
+any patent claim is infringed by making, using, selling, offering for
+sale, or importing the Program or any portion of it.
+
+ 11. Patents.
+
+ A "contributor" is a copyright holder who authorizes use under this
+License of the Program or a work on which the Program is based. The
+work thus licensed is called the contributor's "contributor version".
+
+ A contributor's "essential patent claims" are all patent claims
+owned or controlled by the contributor, whether already acquired or
+hereafter acquired, that would be infringed by some manner, permitted
+by this License, of making, using, or selling its contributor version,
+but do not include claims that would be infringed only as a
+consequence of further modification of the contributor version. For
+purposes of this definition, "control" includes the right to grant
+patent sublicenses in a manner consistent with the requirements of
+this License.
+
+ Each contributor grants you a non-exclusive, worldwide, royalty-free
+patent license under the contributor's essential patent claims, to
+make, use, sell, offer for sale, import and otherwise run, modify and
+propagate the contents of its contributor version.
+
+ In the following three paragraphs, a "patent license" is any express
+agreement or commitment, however denominated, not to enforce a patent
+(such as an express permission to practice a patent or covenant not to
+sue for patent infringement). To "grant" such a patent license to a
+party means to make such an agreement or commitment not to enforce a
+patent against the party.
+
+ If you convey a covered work, knowingly relying on a patent license,
+and the Corresponding Source of the work is not available for anyone
+to copy, free of charge and under the terms of this License, through a
+publicly available network server or other readily accessible means,
+then you must either (1) cause the Corresponding Source to be so
+available, or (2) arrange to deprive yourself of the benefit of the
+patent license for this particular work, or (3) arrange, in a manner
+consistent with the requirements of this License, to extend the patent
+license to downstream recipients. "Knowingly relying" means you have
+actual knowledge that, but for the patent license, your conveying the
+covered work in a country, or your recipient's use of the covered work
+in a country, would infringe one or more identifiable patents in that
+country that you have reason to believe are valid.
+
+ If, pursuant to or in connection with a single transaction or
+arrangement, you convey, or propagate by procuring conveyance of, a
+covered work, and grant a patent license to some of the parties
+receiving the covered work authorizing them to use, propagate, modify
+or convey a specific copy of the covered work, then the patent license
+you grant is automatically extended to all recipients of the covered
+work and works based on it.
+
+ A patent license is "discriminatory" if it does not include within
+the scope of its coverage, prohibits the exercise of, or is
+conditioned on the non-exercise of one or more of the rights that are
+specifically granted under this License. You may not convey a covered
+work if you are a party to an arrangement with a third party that is
+in the business of distributing software, under which you make payment
+to the third party based on the extent of your activity of conveying
+the work, and under which the third party grants, to any of the
+parties who would receive the covered work from you, a discriminatory
+patent license (a) in connection with copies of the covered work
+conveyed by you (or copies made from those copies), or (b) primarily
+for and in connection with specific products or compilations that
+contain the covered work, unless you entered into that arrangement,
+or that patent license was granted, prior to 28 March 2007.
+
+ Nothing in this License shall be construed as excluding or limiting
+any implied license or other defenses to infringement that may
+otherwise be available to you under applicable patent law.
+
+ 12. No Surrender of Others' Freedom.
+
+ If conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot convey a
+covered work so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you may
+not convey it at all. For example, if you agree to terms that obligate you
+to collect a royalty for further conveying from those to whom you convey
+the Program, the only way you could satisfy both those terms and this
+License would be to refrain entirely from conveying the Program.
+
+ 13. Remote Network Interaction; Use with the GNU General Public License.
+
+ Notwithstanding any other provision of this License, if you modify the
+Program, your modified version must prominently offer all users
+interacting with it remotely through a computer network (if your version
+supports such interaction) an opportunity to receive the Corresponding
+Source of your version by providing access to the Corresponding Source
+from a network server at no charge, through some standard or customary
+means of facilitating copying of software. This Corresponding Source
+shall include the Corresponding Source for any work covered by version 3
+of the GNU General Public License that is incorporated pursuant to the
+following paragraph.
+
+ Notwithstanding any other provision of this License, you have
+permission to link or combine any covered work with a work licensed
+under version 3 of the GNU General Public License into a single
+combined work, and to convey the resulting work. The terms of this
+License will continue to apply to the part which is the covered work,
+but the work with which it is combined will remain governed by version
+3 of the GNU General Public License.
+
+ 14. Revised Versions of this License.
+
+ The Free Software Foundation may publish revised and/or new versions of
+the GNU Affero General Public License from time to time. Such new versions
+will be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+ Each version is given a distinguishing version number. If the
+Program specifies that a certain numbered version of the GNU Affero General
+Public License "or any later version" applies to it, you have the
+option of following the terms and conditions either of that numbered
+version or of any later version published by the Free Software
+Foundation. If the Program does not specify a version number of the
+GNU Affero General Public License, you may choose any version ever published
+by the Free Software Foundation.
+
+ If the Program specifies that a proxy can decide which future
+versions of the GNU Affero General Public License can be used, that proxy's
+public statement of acceptance of a version permanently authorizes you
+to choose that version for the Program.
+
+ Later license versions may give you additional or different
+permissions. However, no additional obligations are imposed on any
+author or copyright holder as a result of your choosing to follow a
+later version.
+
+ 15. Disclaimer of Warranty.
+
+ THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY
+APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT
+HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY
+OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO,
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM
+IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF
+ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. Limitation of Liability.
+
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS
+THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY
+GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF
+DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD
+PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS),
+EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGES.
+
+ 17. Interpretation of Sections 15 and 16.
+
+ If the disclaimer of warranty and limitation of liability provided
+above cannot be given local legal effect according to their terms,
+reviewing courts shall apply local law that most closely approximates
+an absolute waiver of all civil liability in connection with the
+Program, unless a warranty or assumption of liability accompanies a
+copy of the Program in return for a fee.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Programs
+
+ If you develop a new program, and you want it to be of the greatest
+possible use to the public, the best way to achieve this is to make it
+free software which everyone can redistribute and change under these terms.
+
+ To do so, attach the following notices to the program. It is safest
+to attach them to the start of each source file to most effectively
+state the exclusion of warranty; and each file should have at least
+the "copyright" line and a pointer to where the full notice is found.
+
+
+ Copyright (C)
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+
+Also add information on how to contact you by electronic and paper mail.
+
+ If your software can interact with users remotely through a computer
+network, you should also make sure that it provides a way for users to
+get its source. For example, if your program is a web application, its
+interface could display a "Source" link that leads users to an archive
+of the code. There are many ways you could offer source, and different
+solutions will be better for different programs; see section 13 for the
+specific requirements.
+
+ You should also get your employer (if you work as a programmer) or school,
+if any, to sign a "copyright disclaimer" for the program, if necessary.
+For more information on this, and how to apply and follow the GNU AGPL, see
+.
diff --git a/README.md b/README.md
index 9ace0e0..f1a6c35 100644
--- a/README.md
+++ b/README.md
@@ -2,15 +2,44 @@
This repository was made for beginners to start learning Javascript from Scratch
-# EsLint
+## Documentation
-Lint your js file with eslint
+This repository uses [Docsify](https://docsify.js.org) for generating documentation website on the fly.
+
+If you want to run Docsify, you must use the latest version of node (now is v13.0.1).
+read this issue [#299](https://github.com/Swap76/Learn-JavaScript/issues/299)
+
+
+**Steps:**
+1. Install dependencies.
+ ```
+ npm install
+ ```
+2. Then run the following command to serve the documentation.
+ ```
+ npm run serve-docs
+ ```
+3. Now you can preview documentation site in your browser by visiting `http://localhost:3000`.
+
+## ESLint
+
+After making your changes or adding your contributions, lint your javascript files with eslint by running the following command.
+While linting, many errors may arise. Don't try to fix errors from other files except yours as this is a tutorial repo some mistakes are intentional.
```sh
-$ npm run lint
+$ npm run lint:fix
```
-### Documentation
-This repository using [Docsify](https://docsify.js.org) for generate documentation website on the fly.
+## References
+
+### [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
+One of the famous reference site for Javascript, it introduces various concepts from beginning to advanced.
+
+### [w3schools.com](https://www.w3schools.com/js/)
+W3Schools is an educational website for learning web technologies online. Content includes tutorials and references relating to HTML, CSS, JavaScript and many more.
+
+### [The Modern JavaScript Tutoial](https://javascript.info/)
+This web site introduces JavaScript with well-sorted topics, giving a basic overview of JavaScript.
-You can run the local server with command `Docsify serve docs` and preview documentation site in your browser on http://localhost:3000.
+### [TutorialPoint](https://www.tutorialspoint.com/index.htm)
+They provide a variety of media content such as videos, eBooks, and other learning materials making JavaScript much simpler.
diff --git a/References.md b/References.md
deleted file mode 100644
index e193e58..0000000
--- a/References.md
+++ /dev/null
@@ -1,2 +0,0 @@
-If you want to learn more about JS's syntax and methods, check out [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript)
-
diff --git a/docs/Exercise/JavaScript_Basics/Exercise-1.md b/docs/Exercise/JavaScript_Basics/Exercise-1.md
deleted file mode 100644
index 88e1e0e..0000000
--- a/docs/Exercise/JavaScript_Basics/Exercise-1.md
+++ /dev/null
@@ -1,7 +0,0 @@
-1. **Create** an object of class `Student` containing his/her `first name`, `last name`, `age`, `college` and `bio`.
-
-2. Encapsulate *(with getters and setters)* the user details **using normal functions**.
-
-3. **Implement** a class `Student`, which should contain his/her `first name`, `last name`, `age`, `college` and `bio`.
-
-4. Encapsulate *(with getters and setters)* the user details **using class members**.
diff --git a/docs/Exercise_Questions/Splice_&_Slice.md b/docs/Exercise_Questions/Splice_&_Slice.md
new file mode 100644
index 0000000..5ecfc2f
--- /dev/null
+++ b/docs/Exercise_Questions/Splice_&_Slice.md
@@ -0,0 +1,31 @@
+Questions on Splice:
+
+1. **write** the code/function(use splice()) to add "Saturday" inside daysOfTheWeek in the correct position if:
+var daysOfTheWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Sunday"]
+
+**Expected Output**:
+ var daysOfTheWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday", "Sunday"]
+
+2. Given var monthsOfTheYear = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"] , write a code/function(use splice()) to remove all months beginning from May and including May.
+
+**Expected Output**:
+monthsOfTheYear = [ 'January', 'February', 'March', 'April' ]
+
+3. Given var numbers = ['1','2','2','4','5'] , remove the repeated number and insert '3' such that the numbers are in ascending order.
+
+**Expected Output**:
+numbers = ['1','2','3','4','5']
+
+4. Does splice() modify the original array?
+
+Questions on Slice:
+
+1. **write** the code/function(use slice()) to extract "Saturday" from daysOfTheWeek array:
+var daysOfTheWeek = ["Monday", "Tuesday", "Wednesday", "Thursday", "Friday","Saturday", "Sunday"]
+
+2. What will citrus contain?
+
+ var fruits = ["Banana", "Orange", "Lemon", "Apple", "Mango"];
+ var citrus = fruits.slice(-3,-2);
+
+3. Does slice() modify the original array?
diff --git a/docs/Exercise_Questions/array_method.md b/docs/Exercise_Questions/array_method.md
new file mode 100644
index 0000000..87869e5
--- /dev/null
+++ b/docs/Exercise_Questions/array_method.md
@@ -0,0 +1,4 @@
+1. **Create** an array called `numbers`
+2. **Create** an empty array called `newArray`
+3. **Iterate** through each element in the numbers array
+4. **Alter** any element and put the altered value into the new array
\ No newline at end of file
diff --git a/docs/Exercise_Questions/bitwise_operator.md b/docs/Exercise_Questions/bitwise_operator.md
new file mode 100644
index 0000000..6c45cd7
--- /dev/null
+++ b/docs/Exercise_Questions/bitwise_operator.md
@@ -0,0 +1,12 @@
+**Write** a Javascript program to return the numerical value corresponding to the bitwise AND of two values
+
+
+**For example** yourFunction(5, 13) will return 5
+
+**Why ?**
+
+
+
5 binary representation is equal to 0101
+
13 binary representation is equal to 1101
+
0101 AND 1101 = 0101 = 5 in decimal representation
+
\ No newline at end of file
diff --git a/docs/Exercise_Questions/boolean.md b/docs/Exercise_Questions/boolean.md
new file mode 100644
index 0000000..4c636e3
--- /dev/null
+++ b/docs/Exercise_Questions/boolean.md
@@ -0,0 +1,39 @@
+## Excercise to understand 'Boolean' data type
+
+Let us go through some examples below to understand the concepts:
+
+```js
+console.log( !!0 ); // false
+
+console.log( !!1 ); // true
+
+console.log( !!undefined ); // false
+
+console.log( !!null ); // false
+
+const emptyString = '';
+
+console.log( !emptyString ); // true
+console.log( !!emptyString ); // false
+
+const anyString = "test value";
+
+console.log( !anyString ); // false
+console.log( !!anyString ); // true
+
+const obj = {};
+
+console.log( !obj ); // false
+console.log( !!obj ); // true
+
+const arr = [];
+
+console.log( !arr ); // false
+console.log( !!arr ); // true
+
+const negativeNum = -1;
+
+console.log( !negativeNum ); // false
+console.log( !!negativeNum ); // true
+
+```
diff --git a/docs/Exercise_Questions/classes.md b/docs/Exercise_Questions/classes.md
new file mode 100644
index 0000000..0107aa0
--- /dev/null
+++ b/docs/Exercise_Questions/classes.md
@@ -0,0 +1,78 @@
+# Challenges
+
+I would recommend to create new file for each challenges. Copy the provided code and write your own code in the `// ... your function here` part.
+
+## Classes
+
+**Have a look how the class is being used to work out what it needs to do.**
+
+1. Create a class that represents a light switch
+
+ ```javascript
+ // ... your code to create a lightswitch
+
+ let lightswitch = new Lightswitch();
+
+ // you can turn it on
+ lightswitch.turnOn();
+
+ // you can check whether it is on or not
+ console.log(lightswitch.isOn()); // true
+
+ // you can turn it off
+ lightswitch.turnOff();
+
+ console.log(lightswitch.isOn()); // false
+ ```
+2. Create a class that represents a car
+
+ ```javascript
+ // ... your code to create a car
+
+ // you pass in a make and number plate
+ let car = new Car("Honda", "BD51 SMR");
+
+ // you can get various information about it
+ console.log(car.getNumberplate()); // "BD51 SMR"
+ console.log(car.getMake()); // "Honda"
+ console.log(car.getMileage()); // 0
+
+ // you can add journey
+ car.addJourney(100);
+ console.log(car.getMileage()); // 100
+
+ car.addJourney(200);
+ console.log(car.getMileage()); // 300
+ ```
+
+3. Write a JavaScript program to list the properties of a JavaScript object.
+ Sample object:
+ ```js
+ var student = {
+ name : "David Rayy",
+ sclass : "VI",
+ rollno : 12
+ };
+ ```
+ Sample Output: name,sclass,rollno
+
+4. Write a JavaScript program to delete the rollno property from the following object. Also print the object before or after deleting the property.
+ Sample object:
+ ```js
+ var student = {
+ name : "David Rayy",
+ sclass : "VI",
+ rollno : 12
+ };
+ ```
+
+5. Create a TV class with properties like brand, channel and volume.
+ Specify brand in a constructor parameter. Channel should be 1 by default. Volume should be 50 by default.
+
+6. To Above class, Add methods to increase and decrease volume. Volume can't never be below 0 or above 100.
+
+7. To Above class, Add a method to set the channel. Let's say the TV has only 50 channels so if you try to set channel 60 the TV will stay at the current channel.
+
+8. To Above class, Add a method to reset TV so it goes back to channel 1 and volume 50. (Hint: consider using it from the constructor).
+
+
diff --git a/docs/Exercise_Questions/comparison_operators.md b/docs/Exercise_Questions/comparison_operators.md
new file mode 100644
index 0000000..ae629e9
--- /dev/null
+++ b/docs/Exercise_Questions/comparison_operators.md
@@ -0,0 +1,121 @@
+### Comparison Operators Exercises
+
+***Note: __ = blank**
+
+
+**1. Fill in the blank with the correct comparison operator to alert true, when x is greater than y.**
+
+ x = 10;
+ y = 5;
+ alert(x __ y);
+
+
+SHOW ANSWER
+>
+
+
+
+**2. Fill in the blank with the correct comparison operator to alert true, when x is equal to y.**
+
+ x = 10;
+ y = 10;
+ alert(x __ y);
+
+
+SHOW ANSWER
+== OR ===
+
+
+
+**3. Fill in the blank with the correct comparison operator to alert true, when x is NOT equal to y.**
+
+ x = 10;
+ y = 5;
+ alert(x __ y);
+
+
+SHOW ANSWER
+!= OR !==
+
+
+
+**4. Fill in the three blanks with the correct conditional (ternary) operators to alert "Too young" if age is less than 18, otherwise alert "Old enough".**
+
+ var age = n;
+ var votingStatus = (age __ 18) __ "Too young" __ "Old enough";
+ alert(votingStatus);
+
+
+SHOW ANSWER
+< ? :
+
+
+
+**5. Will the output for this statement be true or false?**
+
+ console.log(1 == 1);
+
+
+SHOW ANSWER
+true
+
+
+
+**6. Will the output for this statement be true or false?**
+
+ console.log(1 == "1");
+
+
+SHOW ANSWER
+true
+
+
+
+**7. Will the output for this statement be true or false?**
+
+ console.log(1 === 1);
+
+
+SHOW ANSWER
+true
+
+
+
+**8. Will the output for this statement be true or false?**
+
+ console.log(1 === "1");
+
+
+SHOW ANSWER
+false
+
+
+
+**9. Will the output for this statement be true or false?**
+
+ console.log(1 != "1");
+
+
+SHOW ANSWER
+false
+
+
+
+**10. Will the output for this statement be true or false?**
+
+ console.log(1 !== "1");
+
+
+SHOW ANSWER
+true
+
+
+
+**11. What will the value of the variable color be after the following statement is executed?**
+
+ var color = 5 < 10 ? "red" : "blue";
+
+
+SHOW ANSWER
+"red"
+
diff --git a/docs/Exercise_Questions/continue_break.md b/docs/Exercise_Questions/continue_break.md
new file mode 100644
index 0000000..b169f43
--- /dev/null
+++ b/docs/Exercise_Questions/continue_break.md
@@ -0,0 +1,28 @@
+### Continue Exercise
+1. **Sets** a variable before the loop starts (var i = 0).
+2. **Make** the loop continue when i is 2 and 7
+3. **Sum** after the condition of the continue, add the value of the "i" into a
+accumulator variable called sum
+4. **Print** the final value of var sum
+
+ **Expected Output**:
+ 19
+
+ Reference loop
+ ```js
+ for (var i = 0; i <= 7; i++) {}
+ ```
+
+### Break Exercise
+1. **Sets** a variable before the loop starts (var i = 0).
+2. **Sum** before the condition of the break, add the value of the "i" into a accumulator variable called sum
+3. **Make** the loop break when i is 3
+4. **Print** the final value of var sum
+
+ **Expected Output**:
+ 6
+
+ Reference loop
+ ```js
+ for (var i = 0; i <= 7; i++) {}
+ ```
\ No newline at end of file
diff --git a/docs/Exercise_Questions/date.md b/docs/Exercise_Questions/date.md
new file mode 100644
index 0000000..e4d89cf
--- /dev/null
+++ b/docs/Exercise_Questions/date.md
@@ -0,0 +1,127 @@
+1.**Write** a JavaScript program to get the `current date`.
+
+**Expected Output**:
+
+**mm-dd-yyyy**, **mm/dd/yyyy** or **dd-mm-yyyy**, **dd/mm/yyyy**
+
+2. Write a JavaScript function to check whether an `input` is a date object or not.
+
+Test Data :
+```js
+console.log(is_date("October 13, 2014 11:13:00"));
+console.log(is_date(new Date(86400000)));
+console.log(is_date(new Date(99,5,24,11,33,30,0)));
+console.log(is_date([1, 2, 4, 0]));
+```
+Output :
+```js
+false
+true
+true
+false
+```
+3. Write a JavaScript function to get the current date.
+
+Note : Pass a separator as an argument.
+Test Data :
+```js
+console.log(curday('/'));
+console.log(curday('-'));
+```
+Output :
+```js
+"11/13/2014"
+"11-13-2014"
+```
+4. Write a JavaScript function to get the number of days in a month.
+
+Test Data :
+```js
+console.log(getDaysInMonth(1, 2012));
+console.log(getDaysInMonth(2, 2012));
+console.log(getDaysInMonth(9, 2012));
+console.log(getDaysInMonth(12, 2012));
+```
+Output :
+```js
+31
+29
+30
+31
+```
+5. Write a JavaScript function to get the month name from a particular date.
+
+Test Data :
+```js
+console.log(month_name(new Date("10/11/2009")));
+console.log(month_name(new Date("11/13/2014")));
+```
+Output :
+```js
+"October"
+"November"
+```
+6. Write a JavaScript function to compare dates (i.e. greater than, less than or equal to).
+
+Test Data :
+```js
+console.log(compare_dates(new Date('11/14/2013 00:00'), new Date('11/14/2013 00:00')));
+console.log(compare_dates(new Date('11/14/2013 00:01'), new Date('11/14/2013 00:00')));
+console.log(compare_dates(new Date('11/14/2013 00:00'), new Date('11/14/2013 00:01')));
+```
+Output :
+```js
+"Date1 = Date2"
+"Date1 > Date2"
+```
+7. Write a JavaScript function to add specified minutes to a Date object.
+
+Test Data :
+```js
+console.log(add_minutes(new Date(2014,10,2), 30).toString());
+```
+Output :
+```js
+"Sun Nov 02 2014 00:30:00 GMT+0530 (India Standard Time)"
+```
+8. Write a JavaScript function to test whether a date is a weekend.
+
+Note : Use standard Saturday/Sunday definition of a weekend.
+Test Data :
+```js
+console.log(is_weekend('Nov 15, 2014'));
+console.log(is_weekend('Nov 16, 2014'));
+console.log(is_weekend('Nov 17, 2014'));
+```
+Output :
+```js
+"weekend"
+"weekend"
+undefined
+```
+9. Write a JavaScript function to get difference between two dates in days.
+
+Test Data :
+```js
+console.log(date_diff_indays('04/02/2014', '11/04/2014'));
+console.log(date_diff_indays('12/02/2014', '11/04/2014'));
+```
+Output :
+```js
+216
+-28
+```
+10. Write a JavaScript function to get the last day of a month.
+
+Test Data :
+```js
+console.log(lastday(2014,0));
+console.log(lastday(2014,1));
+console.log(lastday(2014,11));
+```
+Output :
+```js
+31
+28
+31
+```
diff --git a/docs/Exercise_Questions/filter.md b/docs/Exercise_Questions/filter.md
new file mode 100644
index 0000000..755d085
--- /dev/null
+++ b/docs/Exercise_Questions/filter.md
@@ -0,0 +1,34 @@
+### Filter Exercises
+**1. Filter the array with values greated than 10**
+1. **Create** an array called numbers with the next elements
+`array` = [21,10,5,9,100,2,5,6,90,25,14,32]
+2. **Filter** the numbers greater than 10
+3. **Print** the result of filter
+
+ **Expected Output**:
+ [21,100,90,25,14,32]
+
+**2. Write a JavaScript code that filters an array of integers to even integers and odd integers.**
+```javascript
+let numbers = [1,232,143,101,73,99,23,1998];
+// let even_integers =
+// let odd_integers =
+
+console.log(even_integers); // [232,1998]
+console.log(odd_integers); // [1,143,101,73,99,23]
+```
+
+Solution
+
+
diff --git a/docs/Exercise_Questions/for_each.md b/docs/Exercise_Questions/for_each.md
new file mode 100644
index 0000000..9dba3d4
--- /dev/null
+++ b/docs/Exercise_Questions/for_each.md
@@ -0,0 +1,32 @@
+## JavaScript Array forEach() Method
+
+/*
+-- forEach() method takes a callback function then loops through all the array elements and execute the callback function once for each array element
+-- forEach() method DOES NOT modify the array and unlike map() method, forEach() DOES NOT return a new array
+*/
+// assume we have an array of numbers and we need to get square of each number
+```js
+const numbers = [5, 4, 6, 12, 23, 1, 72], squares = [];
+
+[5, 4, 6, 12, 23, 1, 72].forEach(n => {
+ squares.push(n * n)
+});
+
+console.log(squares);
+```
+expected output: Array [25, 16, 36, 144, 529, 1, 5184]
+
+/*
+-- Another example using index of elements in the callback function
+-- In this example, we create an Object from an Array
+*/
+```js
+const users = ['John', 'Sally', 'Brad', 'Jack'], usersObj = {}
+
+users.forEach((user, index) => {
+ usersObj[index] = user
+})
+
+console.log(usersObj)
+```
+expected output : Object {0: "John", 1: "Sally", 2: "Brad", 3: "Jack"}
diff --git a/docs/Exercise_Questions/higher_order_functions.md b/docs/Exercise_Questions/higher_order_functions.md
new file mode 100644
index 0000000..95bef02
--- /dev/null
+++ b/docs/Exercise_Questions/higher_order_functions.md
@@ -0,0 +1,26 @@
+1. Write an function `square` which takes an array as input and return a new array use [map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) method.
+For example, `square([1,2,3,4])` should return `[1,4,9,16]`.
+
+2. Write an function `getOdd` which takes an array of number as input and return a new array contains only odd number use [filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) method.
+For example, `getOdd([1,2,3,4,5])` should return `[1,3,5]`.
+
+
+Solution
+
+
+1. Use `Array.prototype.map` method.
+```js
+function square(arr) {
+ return arr.map(number => number * number);
+}
+```
+
+2. Use `Array.prototype.filter` method.
+```js
+function getOdd(arr){
+ return arr.filter(num => num % 2 === 1);
+}
+```
+
+
+
diff --git a/docs/Exercise_Questions/if_else.md b/docs/Exercise_Questions/if_else.md
new file mode 100644
index 0000000..554bc7f
--- /dev/null
+++ b/docs/Exercise_Questions/if_else.md
@@ -0,0 +1,137 @@
+### If Else Exercises
+
+**1. Write a JavaScript program to determine if a number is positive, negative, or zero.**
+
+```
+Example Input:
+6
+0
+-20
+```
+
+```
+Expected Output:
+"positive"
+"zero"
+"negative"
+```
+
+**2. Look up how to get the current time in Javascript. Based on this, create a series of if-else statements that will check against the current time and print either:**
+
+- "Good morning!" if it's from 6:00am-12:00pm
+- "Good afternoon!" if the time is between 12:00pm - 6:00pm
+- "Good evening!" if the time is from 6:00pm to Midnight
+- "Good night!" if the time is from Midnight to 6:00am.
+
+**3. Write a JavaScript code that identifies whether a number is odd or even. _Hint: A number is even if it is divisible by two, otherwise it is odd._**
+
+```
+Example Input:
+143
+27
+100
+```
+
+```
+Expected Output:
+"odd"
+"odd"
+"even"
+```
+
+Solution
+
+
+
+**4. Write a JavaScript function that tells the user whether a code is the right password or not. If the password is correct then the output should be "Vault opening...", if it's not the output should be "Wrong Password!".**
+
+```
+Example Input:
+"abcd12345"
+with correct password being "abcd12345"
+```
+
+```
+Expected Output:
+"Vault opening..."
+```
+
+Solution
+
+
+
+5. Write a JavaScript conditional statement to find the sign of product of three numbers. Display an alert box with the specified sign.
+Sample numbers : 3, -7, 2
+Output : The sign is -
+
+6. Write a JavaScript conditional statement to sort three numbers. Display an alert box to show the result.
+Sample numbers : 0, -1, 4
+Output : 4, 0, -1
+
+7. Write a JavaScript program which compute, the average marks of the following students Then, this average is used to determine the corresponding grade. Go to the editor
+
+Student Name Marks
+David 80
+Vinoth 77
+Divya 88
+Ishitha 95
+Thomas 68
+The grades are computed as follows :
+
+Range Grade
+<60 F
+<70 D
+<80 C
+<90 B
+<100 A
+
+8. According to Wikipedia a happy number is defined by the following process :
+"Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle which does not include 1. Those numbers for which this process ends in 1 are happy numbers, while those that do not end in 1 are unhappy numbers (or sad numbers)".
+Write a JavaScript program to find and print the first 5 happy numbers.
+
+9. You are given a variable marks. Your task is to print:
+
+- AA if marks is greater than 90.
+- AB if marks is greater than 80 and less than or equal to 90.
+- BB if marks is greater than 70 and less than or equal to 80.
+- BC if marks is greater than 60 and less than or equal to 70.
+- CC if marks is greater than 50 and less than or equal to 60.
+- CD if marks is greater than 40 and less than or equal to 50.
+- DD if marks is greater than 30 and less than or equal to 40.
+- FF if marks is less than or equal to 30.
+
+10. Write a function named pluralize that:
+ takes 2 arguments, a noun and a number.
+ returns the number and pluralized form, like "5 cats" or "1 dog".
+ Call that function for a few different scores and log the result to make sure it works.
+ Bonus: Make it handle a few collective nouns like "sheep" and "geese".
+
+11. Write a JavaScript program that prompts for an employee name, SSN, rate of pay, and hours worked, and computes the total pay for the employee. If the hours worked is greater than 40, use one and the half for overtime rate (for hours beyond 40) and compute accordingly.
\ No newline at end of file
diff --git a/docs/Exercise_Questions/inheritance.md b/docs/Exercise_Questions/inheritance.md
new file mode 100644
index 0000000..8577316
--- /dev/null
+++ b/docs/Exercise_Questions/inheritance.md
@@ -0,0 +1 @@
+**Write** a Javascript function called Vehicle that has variables [Make and Model] in it. Then write another function called Car that calls Vehicle function and also add two more variables [Body and Trim]. Once that is done you can call Car function and see that it inherits from Vehicle.
\ No newline at end of file
diff --git a/docs/Exercise_Questions/looping_objects.md b/docs/Exercise_Questions/looping_objects.md
new file mode 100644
index 0000000..91ede6c
--- /dev/null
+++ b/docs/Exercise_Questions/looping_objects.md
@@ -0,0 +1,70 @@
+1. Given an object
+```js
+const person = {
+ name: 'John Doe',
+ age: 26,
+ gender: 'Male'
+}
+```
+Write code to iterate through `person` object and output something like
+```js
+person.name = John Doe
+person.age = 26
+person.gender = Male
+```
+
+2. Given the following code
+```js
+function Dog (age) {
+ this.age = age;
+}
+
+Dog.prototype = {
+ bark: () => console.log('woof')
+}
+
+const dog = new Dog(2);
+```
+
+Write code to iterate through `dog` object and output something like
+```js
+dog.age = 2
+```
+
+
+Solution
+
+
diff --git a/docs/Exercise_Questions/number_methods.md b/docs/Exercise_Questions/number_methods.md
new file mode 100644
index 0000000..a1cf641
--- /dev/null
+++ b/docs/Exercise_Questions/number_methods.md
@@ -0,0 +1,135 @@
+1. Write code to determine if the following values are _Finite_.
+The output should be a **boolean value**
+```js
+
+ var number9 = 9;
+ var infinity = Infinity;
+ var notANumber = NaN;
+ var zero = 0;
+ var exponentNumber = 2e10;
+ var stringZero = '0';
+ var nothing = null;
+ var divideByZero = 1/0;
+ var oneFourth = 1/4;
+```
+
+2. Write code to determine if the following values are _Integers_.
+The output should be a **boolean value**
+```js
+ var zero = 0;
+ var one = 1;
+ var oneTenthAsDecimal = 0.1;
+ var pi = Math.PI;
+ var stringTen = '10';
+ var fiveAnd1Decimal = 5.0;
+ var fiveAnd8Decimal = 5.00000001;
+ var fiveAnd16Decimal = 5.0000000000000001;
+```
+
+3. Write code to determine if the following values are _Not a number_.
+The output should be a **boolean value**
+```js
+ var nan = NaN;
+ var zeroDividedByZero = 0/0;
+ var stringNotANumber = 'NaN';
+ var emptyObject = {};
+ var stringThirty = '30';
+ var thirty = 30;
+ var someText = 'some text';
+ var emptyString = '';
+ var singleSpace = ' ';
+
+```
+
+4. Write code to determine if the following values are _safe integers_.
+The output should be a **boolean value**
+```js
+ var nan = NaN;
+ var infinity = Infinity;
+ var stringThirty = '30';
+ var thirty = 30;
+ var fiveAnd1Decimal = 5.0;
+ var oneTenthAsDecimal = 0.1;
+```
+
+5. Write code to convert the following values _to exponential form_.
+The output should be **string representing the Number object in exponential notation.**
+```js
+ var numbers = 123456;
+ // expect numbers to be 1.23456e+5
+
+ var numberWith5Decimals = 5.01234;
+ // expect numberWith5Decimals to be 5.01e+0
+
+ var oneTenthAsDecimal = 0.1;
+ // expect oneTenthAsDecimal to be 1e-1
+```
+
+6. Write code to convert the following values _to fixed-point notation_.
+
+```js
+ var floatingNumber1 = 123.456;
+ // expect floatingNumber1 to return 123.46
+
+ var floatingNumber2 = 123.000009;
+ // expect floatingNumber2 to return 123
+
+ var exponentNumber3 = 1.23e+10;
+ // expect exponentNumber3 to return 12300000000.00
+
+ var floatingNumber4 = 1.55;
+ // expect floatingNumber4 to return 1.6
+
+```
+
+7. Write code to return a string with a language-sensitive representation of the `Number`
+```js
+ var germanNumber = 123.34
+ // expect value to be 123,12
+ var arabicNumber = 123.11
+ // expect value to be ١٢٣٫١٢
+
+```
+
+8. Write code to returns a string representing the `Number` object to the specified precision.
+```js
+ var floatingNumber1 = 123.456;
+ // expect floatingNumber1 to be precise up to 2 digits.
+ // The expected output should be 1.2e+2
+ var exponentNumber3 = 1.23e+10;
+ // expect exponenentNumber3 to be precise up to 4 digits.
+ // The expected output should be 1.230e+10
+
+ var numberWith5Decimals = 5.01234;
+ // expect numberWith5Decimals to be precise up to 0 digits.
+ // The expected output should be 5
+```
+
+9. Write code to return a string representing the specified `Number` object.
+```js
+ // NOTE:
+ // when outputting the results to a browser's console.
+ // The double quotes will not be displayed
+ // You can verify the output by checking its 'type' and
+ // confirm that it is of type String
+
+ var floatingNumber1 = 123.456;
+ // expect floatingNumber1 to be in string format "123.456"
+
+ var exponentNumber3 = 1.23e+10;
+ // expect exponenentNumber3 to be in string format "12300000000"
+
+ var pi = Math.PI;
+ // expect pi to be in string format "3.141592653589793"
+```
+
+10. Write code to return the wrapped primitive value of a `Number` object.
+```js
+
+ var numberObject = new Number(42);
+ // expect to return the value 42 from the object
+
+ var piObject = new Number(Math.PI);
+ // expect to return the value 3.141592653589793 from the object
+
+```
\ No newline at end of file
diff --git a/docs/Exercise_Questions/object.md b/docs/Exercise_Questions/object.md
new file mode 100644
index 0000000..ec1189d
--- /dev/null
+++ b/docs/Exercise_Questions/object.md
@@ -0,0 +1,116 @@
+1. **Create** an object of class `Student` containing his/her `first name`, `last name`, `age`, `college` and `bio`.
+
+2. Encapsulate *(with getters and setters)* the user details **using normal functions**.
+
+3. **Implement** a class `Student`, which should contain his/her `first name`, `last name`, `age`, `college` and `bio`.
+
+4. Encapsulate *(with getters and setters)* the user details **using class members**.
+
+# Answer
+
+### Solution Using Object
+```js
+const student = {
+ firstName: "Swapnil",
+ lastName: "Shinde",
+ age: 19,
+ college: "SIES",
+ bio: "Web developer"
+};
+
+getFullName = () => {
+ return `${student.firstName} ${student.lastName}`;
+};
+
+getBio = () => {
+ return student.bio;
+};
+
+getAllDetails = () => {
+ return `My name is ${student.firstName} ${student.lastName} \nMy age is ${student.age} \nMy college is ${student.college}, I am ${student.bio}.`;
+};
+
+console.log(getFullName()); // Output Swapnil Shinde
+
+console.log(getBio()); // Output Web developer
+
+console.log(getAllDetails()); // Output My name is Swapnil Shinde. My age is 19. My college is SIES, I am Web developer.
+```
+
+### Solution Using Classes
+```js
+class Student {
+ // Created the constructor for student
+ constructor (firstName, lastName, age, college, bio) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ this.college = college;
+ this.bio = bio;
+ }
+
+ // This method returns combined firstname and lastname
+ getFullName () {
+ return (`${this.firstName} ${this.lastName}`);
+ }
+
+ // This method returns bio
+ getBio () {
+ return (`${this.bio}`);
+ }
+
+ // This method returns All details
+ getAllDetails () {
+ return (`My name is ${this.firstName} ${this.lastName} \nMy age is ${this.age} \nMy college is ${this.college}, I am ${this.bio}.`);
+ }
+}
+
+const Swapnil = new Student("Swapnil", "Shinde", 19, "SIES", "Web Developer"); // Created object with arguments
+
+console.log(Swapnil.getFullName()); // Output Swapnil Shinde
+
+console.log(Swapnil.getBio()); // Output Web Developer
+
+console.log(Swapnil.getAllDetails()); // Output My name is Swapnil Shinde. My age is 19. My college is SIES, I am Web Developer.
+
+console.log(Swapnil); // This returns the object only
+/*
+ Output
+
+Student {
+ firstName: 'Swapnil',
+ lastName: 'Shinde',
+ age: 19,
+ college: 'SIES',
+ bio: 'Web Developer'
+}
+*/
+```
+
+### Solution Using Arrays
+
+```js
+const array = [1, 0.16, "Random", function () {
+ console.log("this is function in an array");
+}, { Key: "Answer" }, false];
+
+console.log("Array can contain anything");
+console.log(array);
+// add last
+array.push("add last");
+console.log(array);
+// remove last
+array.pop();
+console.log(array);
+// add first
+array.shift("add first");
+console.log(array);
+
+// remove first
+array.unshift();
+console.log(array);
+// this element is function
+array[2]();
+// object inside array
+console.log(array[3].Key);
+```
\ No newline at end of file
diff --git a/docs/Exercise_Questions/reduce.md b/docs/Exercise_Questions/reduce.md
new file mode 100644
index 0000000..05fd5ad
--- /dev/null
+++ b/docs/Exercise_Questions/reduce.md
@@ -0,0 +1,53 @@
+# Reduce exercises
+
+The reduce method allows you to "reduce" the contents of an Array into one value.
+
+## 1. Sum of prices
+Write a function that sums up the prices in a shopping cart.
+
+```js
+const items = [
+ { name: 'Flour', price: 1 },
+ { name: 'Tomatos', price: 4 },
+ { name: 'Cucumbers', price: 2 },
+ { name: 'Cheese', price: 7 },
+ { name: 'Wine', price: 14 },
+];
+
+const expectedResult = 28;
+```
+
+## 2. Grades by course
+Given a list of grades with their course, return an object where the key is the name of the course and the value is a list of the corresponding grades.
+
+```js
+const grades = [
+ { course: 'Algebra', test: 1, grade: 'A'},
+ { course: 'Algebra', test: 2, grade: 'C'},
+ { course: 'Algebra', test: 3, grade: 'B'},
+ { course: 'Algorithms & Datastructures', test: 1, grade: 'D'},
+ { course: 'Algorithms & Datastructures', test: 2, grade: 'C'},
+ { course: 'Algorithms & Datastructures', test: 3, grade: 'C+'},
+ { course: 'English', test: 1, grade: 'B'},
+ { course: 'English', test: 2, grade: 'C'},
+ { course: 'English', test: 3, grade: 'B'},
+];
+
+const expectedResult = {
+ 'Algebra': [
+ { course: 'Algebra', test: 1, grade: 'A'},
+ { course: 'Algebra', test: 2, grade: 'C'},
+ { course: 'Algebra', test: 3, grade: 'B'},
+ ],
+ 'Algorithms & Datastructures': [
+ { course: 'Algorithms & Datastructures', test: 1, grade: 'D'},
+ { course: 'Algorithms & Datastructures', test: 2, grade: 'C'},
+ { course: 'Algorithms & Datastructures', test: 3, grade: 'C+'},
+ ],
+ 'English': [
+ { course: 'English', test: 1, grade: 'B'},
+ { course: 'English', test: 2, grade: 'C'},
+ { course: 'English', test: 3, grade: 'B'},
+ ]
+};
+```
diff --git a/docs/Exercise_Questions/regex.md b/docs/Exercise_Questions/regex.md
new file mode 100644
index 0000000..3c48a59
--- /dev/null
+++ b/docs/Exercise_Questions/regex.md
@@ -0,0 +1,99 @@
+### Regex Exercises
+**1. Write a JavaScript program to test the first character of a string is uppercase or not.**
+
+
+Solution
+
+
+```javascript
+regexp = /^[A-Z]/;
+
+```
+
+
+
+
+
+**2. Write a JavaScript program to check a credit card number.**
+
+
+Solution
+
+
+
+
+**3. Write a pattern that matches e-mail addresses.**
+ The personal information part contains the following ASCII characters.
+ Uppercase (A-Z) and lowercase (a-z) English letters.
+ Digits (0-9).
+ Characters ! # $ % & * + - / = ? ^ _ { | } ~
+ Character . ( period, dot or fullstop) provided that it is not the first or last character and it will not come one after the other.
+
+
+Solution
+
+
+
+**6. Write a JavaScript program to count number of words in string.**
+Note :
+- Remove white-space from start and end position.
+- Convert 2 or more spaces to 1.
+- Exclude newline with a start spacing.
+
+
+Solution
+
+
+ ```js
+function count_words()
+{
+ str1= document.getElementById("InputText").value;
+
+ //exclude start and end white-space
+ str1 = str1.replace(/(^\s*)|(\s*$)/gi,"");
+
+ //convert 2 or more spaces to 1
+ str1 = str1.replace(/[ ]{2,}/gi," ");
+ // exclude newline with a start spacing
+ str1 = str1.replace(/\n /,"\n");
+ document.getElementById("noofwords").value = str1.split(' ').length;
+}
+```
+
+
+
diff --git a/docs/Exercise_Questions/string.md b/docs/Exercise_Questions/string.md
new file mode 100644
index 0000000..bf94a9d
--- /dev/null
+++ b/docs/Exercise_Questions/string.md
@@ -0,0 +1,89 @@
+### String Operations Exercises
+
+**1. Write a JavaScript function to convert a string in abbreviated form.**
+
+Example of call of the function
+
+**Example**
+Test Data :
+```js
+console.log(abbrev_name("Musa Bajwa"));
+```
+Example Output:-
+"Musa B."
+
+2. **Write** a JavaScript function to concatenates a given string n times (default is 1).
+
+**Example**
+Test Data :
+console.log(repeat('Lol!'));
+console.log(repeat('Lol!',2));
+console.log(repeat('Lol!',3));
+"Lol!"
+"Lol!Lol!"
+"Lol!Lol!Lol!"
+
+3. **Write** a JavaScript function to strip leading and trailing spaces from a string.
+
+**Example**
+
+Test Data :
+console.log(strip('cool '));
+console.log(strip(' cool'));
+console.log(strip(' cool '));
+Output :
+"cool"
+"cool"
+"cool"
+
+4. Write a Javascript program to get the character at the given index within the String.
+
+Sample Output:
+
+Original String = Javascript Exercises!
+The character at position 0 is J
+The character at position 10 is i
+
+5. Write a Javascript program to get the character (Unicode code point) at the given index within the String.
+
+Sample Output:
+
+Original String : w3resource.com
+Character(unicode point) = 51
+Character(unicode point) = 101
+
+6. Write a Javascript program to compare two strings lexicographically.
+
+Sample Output:
+
+String 1: This is Exercise 1
+String 2: This is Exercise 2
+"This is Exercise 1" is less than "This is Exercise 2"
+
+7. Write a Javascript program to test if a given string contains the specified sequence of char values.
+
+Sample Output:
+
+Original String: PHP Exercises and Python Exercises
+Specified sequence of char values: and
+true
+
+8. Write a Javascript program to compare a given string to another string, ignoring case considerations.
+
+Sample Output:
+
+"Stephen Edwin King" equals "Walter Winchell"? false
+"Stephen Edwin King" equals "stephen edwin king"? true
+
+9. Write a Javascript program to get the canonical representation of the string object.
+
+Sample Output:
+
+str1 == str2? false
+str1 == str3? true
+
+10. Write a Javascript program to find whether a region in the current string matches a region in another string.
+Sample Output:
+
+str1[0 - 7] == str2[28 - 35]? true
+str1[9 - 15] == str2[9 - 15]? false
\ No newline at end of file
diff --git a/docs/Exercise_Questions/switch.md b/docs/Exercise_Questions/switch.md
new file mode 100644
index 0000000..11b0004
--- /dev/null
+++ b/docs/Exercise_Questions/switch.md
@@ -0,0 +1,59 @@
+## Switch Case Exercises
+**1. Write a JavaScript function for basic arithmetic computations.** The function should accept two numbers and an operator and should return the computed value. If the operator is not included in the allowed values, return `Invalid operator`. _Hint: "operator" will be compared to each case_
+```
+Parameters:
+x - any number
+y - any number
+operator - one of the arithmetic operators:
+ + (addition)
+ - (subtraction)
+ * or x or X (multiplication)
+ / (division)
+```
+```javascript
+function compute(x,y,operator) {
+ // your code here
+}
+
+console.log(compute(1,6,"*")) //6
+console.log(compute(1,6,"%")) //Invalid operator
+```
+
+
+Solution
+
+
+```javascript
+function compute(x,y,operator) {
+ let answer;
+ // checking if x and y are numbers is optional
+ if(isNaN(x) || isNaN(y)) {
+ return "Invalid number";
+ }
+
+ switch (operator) {
+ case "+":
+ answer = x + y;
+ break;
+ case "-":
+ answer = x - y;
+ break;
+ case "*":
+ case "x":
+ case "X":
+ answer = x * y;
+ break;
+ case "/":
+ answer = x / y;
+ break;
+ default:
+ answer = "Invalid operator";
+ }
+ return answer;
+}
+
+console.log(compute(1,6,"*")); //6
+```
+
+
+
diff --git a/docs/Exercise_Questions/two_strings.md b/docs/Exercise_Questions/two_strings.md
new file mode 100644
index 0000000..a64f4e0
--- /dev/null
+++ b/docs/Exercise_Questions/two_strings.md
@@ -0,0 +1,23 @@
+# Anagram
+
+given two strings as parameters, check whether you can make the first string into the second string. Assume the two strings have equal length
+
+# Example 1
+
+String1 = 'team'
+String2 = 'mate'
+
+should return return true because you can rearrange team to make mate
+
+# Example 2
+
+String1 = 'angered'
+String2 = 'enraged'
+
+Returns true
+
+# Example 3
+String1 = 'evils'
+String2 = 'vile'
+
+return false since the length of two strings are not equal
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/AJAX_request.md b/docs/JavaScript_Advance/AJAX_request.md
new file mode 100644
index 0000000..40c71b4
--- /dev/null
+++ b/docs/JavaScript_Advance/AJAX_request.md
@@ -0,0 +1,30 @@
+```js
+const POST = "POST";
+
+export class AJAXRequest {
+ constructor () {
+ // eslint-disable-next-line no-undef
+ this.request = new XMLHttpRequest();
+ }
+
+ open (method, url, async) {
+ this.method = method;
+ this.request.open(method, url, async);
+ }
+
+ send (string) {
+ const args = this.method === POST ? [string] : [];
+ this.request.send.apply(this.request, args);
+ }
+}
+// OR closure approach
+
+// eslint-disable-next-line no-undef
+const request = new XMLHttpRequest();
+
+let usedMethod;
+export const open = (method, url, async) => {
+ usedMethod = method;
+ request.open(method, url, async);
+};
+export const send = string => (usedMethod === POST ? request.send(string) : request.send());```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/IEEE-754.md b/docs/JavaScript_Advance/IEEE-754.md
new file mode 100644
index 0000000..e35947b
--- /dev/null
+++ b/docs/JavaScript_Advance/IEEE-754.md
@@ -0,0 +1,19 @@
+console.log(0.1 + 0.2); // 0.3000000000000004
+console.log(0.3 + 0.6); // 0.8999999999999999
+
+/*
+Why does this happen?
+It's actually pretty simple. When you have a base 10 system (like ours),
+it can only express fractions that use a prime factor of the base.
+The prime factors of 10 are 2 and 5. So 1/2, 1/4, 1/5, 1/8, and 1/10 can all
+be expressed cleanly because the denominators all use prime factors of 10.
+In contrast, 1/3, 1/6, and 1/7 are all repeating decimals because their denominators
+use a prime factor of 3 or 7. In binary (or base 2), the only prime factor is 2.
+So you can only express fractions cleanly which only contain 2 as a prime factor.
+In binary, 1/2, 1/4, 1/8 would all be expressed cleanly as decimals.
+While, 1/5 or 1/10 would be repeating decimals. So 0.1 and 0.2 (1/10 and 1/5) while clean
+ decimals in a base 10 system, are repeating decimals in the base 2 system
+ the computer is operating in. When you do math on these repeating decimals,
+ you end up with leftovers which carry over when you convert the computer's
+ base 2 (binary) number into a more human readable base 10 number.
+*/
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/JSON.md b/docs/JavaScript_Advance/JSON.md
new file mode 100644
index 0000000..e06b9e8
--- /dev/null
+++ b/docs/JavaScript_Advance/JSON.md
@@ -0,0 +1,9 @@
+const sammy = {
+ first_name: "Sammy",
+ last_name: "Shark",
+ online: true
+};
+// accessing each value using dot notation
+console.log(sammy.first_name);
+console.log(sammy.last_name);
+console.log(sammy.online);
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/XML_http_request.md b/docs/JavaScript_Advance/XML_http_request.md
new file mode 100644
index 0000000..d934ee6
--- /dev/null
+++ b/docs/JavaScript_Advance/XML_http_request.md
@@ -0,0 +1,40 @@
+/***
+ * XMLHttpRequest
+ * can be used to retrieve a server side data without having full page refresh
+ */
+
+const createXhr = () => {
+ return new XMLHttpRequest();
+};
+
+// Request
+const request = isAbort => {
+ const xhr = createXhr();
+
+ // when xhr.send is triggered this function gonna trigger until
+ // ready state is equal 4 and status code is equal 200
+ // to log all response header
+ xhr.onreadystatechange = function () {
+ if (this.readyState == 4 && this.status == 200) {
+ // all headers
+ console.log("all header ==>", this.getAllResponseHeaders());
+ // display specific content type
+ console.log("specific ==>", this.getResponseHeader("content-type"));
+ }
+ };
+
+ // parameter open(method, url, async)
+ // this function gonna request for server side data
+ xhr.open("GET", "https://reqres.in/api/users/2", true);
+ xhr.send();
+
+ if (isAbort) {
+ xhr.abort();
+ console.log("request has been abort");
+ }
+};
+
+// in this case response header should have display
+request();
+// in this case response header should havn't display but will display "request has been abort"
+request(abort);
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/arrayFlat.md b/docs/JavaScript_Advance/arrayFlat.md
deleted file mode 100644
index 10f67f6..0000000
--- a/docs/JavaScript_Advance/arrayFlat.md
+++ /dev/null
@@ -1 +0,0 @@
-# Array Flat Method
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/arrowFunction.md b/docs/JavaScript_Advance/arrowFunction.md
deleted file mode 100644
index 91c9ac4..0000000
--- a/docs/JavaScript_Advance/arrowFunction.md
+++ /dev/null
@@ -1 +0,0 @@
-# Arrow Function
diff --git a/docs/JavaScript_Advance/arrow_function.md b/docs/JavaScript_Advance/arrow_function.md
new file mode 100644
index 0000000..04b8625
--- /dev/null
+++ b/docs/JavaScript_Advance/arrow_function.md
@@ -0,0 +1,84 @@
+```js
+let a = () => {
+ // This is arrow function came new in ES6
+ //It assigns the function to variable a as the identifier with let instead and adds arrows before the curly braces.
+
+};
+
+let multiply = (num) => num * num
+
+//arrow functions also works without curly braces {} and can directly write expression after the arrows
+// this is known as concise body as opposed to a block body (with {});
+//cannot be used with if statements, or an error will appear since it only takes one expression;
+//ternary operators can be used with arrow functions as a more concise way to write if statements
+
+let info = {
+ firstName: "Swapnil",
+ lastName: "Shinde",
+ getFullName: () => {
+ return (`My name is ${this.firstName} ${this.lastName}`); // Arrow functions don't have "this" property
+ }
+}
+//not having this. binding means it also cannot be called with new and used as a constructor
+
+console.log(info.getFullName());
+// Output My name is undefined undefined that's why we don't use this with arrow function
+
+let newInfo = {
+ firstName: "Swapnil",
+ lastName: "Shinde",
+ getFullName: () => {
+ return (`My name is ${newInfo.firstName} ${newInfo.lastName}`); // If we are using arrow function then directly use the variables as shown
+ }
+}
+
+console.log(newInfo.getFullName());
+// Output My name is Swapnil Shinde
+
+// Using arrow functions in Class
+class Student {
+ constructor() {
+ this.name = 'Vishal'
+ }
+
+ getName = () => {
+ return this.name;
+ }
+}
+
+console.log((new Student).getName()) // Gives error for node versions before 12.4.0(Approx) SyntaxError: Unexpected token =
+
+class StudentInfo {
+
+ constructor(firstName, lastName, age, branch, college) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+ this.age = age;
+ this.branch = branch;
+ this.college = college;
+ };
+
+ getFullName = () => { // Returns full name using string interpolation
+ return (`My name is ${this.firstName} ${this.lastName}`); // If we are using arrow function then directly use the variables as shown
+ };
+
+ getBranch = () => { // Returns Branch
+ return (this.branch);
+ };
+
+}
+
+let Swapnil = new StudentInfo("Swapnil", "Shinde", 19, "Computer", "Sies"); // This way we can create new objects with arguments
+
+console.log(Swapnil.getFullName()); // Output My name is Swapnil Shinde
+
+//settimeout without arrow function
+setTimeout(function () {
+ console.log("hello world");
+}, 1000);
+
+//settimeout with arrow function
+setTimeout(() => {
+ console.log("hello world");
+}, 0); //arrow functions provide better readability
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/assignments_arithmetic.md b/docs/JavaScript_Advance/assignments_arithmetic.md
new file mode 100644
index 0000000..3268a2a
--- /dev/null
+++ b/docs/JavaScript_Advance/assignments_arithmetic.md
@@ -0,0 +1,115 @@
+```js
+/* In javascript there are always several ways to the goal.
+Also the syntax of variable assignment can be abbreviated.
+This is particularly suitable for mathematic operators
+*/
+
+/* Default assignment
+Very basic to this point.
+*/
+
+y = "Yes"; // y: "Yes"
+
+/* Adding
+Adds two values.
+*/
+
+// Basic adding
+y = 1 + 1; // y: 2
+
+// Shortcut
+y += 1; // y: 3 (increases y by 1)
+
+// appending strings by adding
+y = "A"; // y: "A"
+y += "B"; // y: "AB"
+
+// Adding string and number
+y = 1; // y: 1
+y += "1"; // y: "11" (treated as text not as numbers)
+
+/* Subtracting
+subtracts two values
+*/
+
+// Basic adding
+y = 5 - 2; // y: 3
+
+// Shortcut
+y -= 1; // y: 2
+
+// substracting strings
+y = "A"; // y: "A"
+y -= "B"; // y: NaN (Not-a-Number aka we-don't-know-what-it-is-but-definitively-not-decimal)
+
+y = "AA"; // y: "AA"
+y -= "A"; // y: NaN (also not working)
+
+// substracting strings and numbers
+y = 3; // y: 3
+y -= "1"; // y: 2
+
+y = "3"; // y: "3"
+y -= 1; // y: 2
+
+/* Multiplication
+Multiply two values
+*/
+
+// Basic
+y = 3 * 2; // y: 6
+
+// Shortcut
+y *= 2; // y: 12 (doubles y)
+y *= 3; // y: 36 (triples y)
+
+// Multiplying strings
+y = "A" * 3; // y: NaN (doesn't work)
+
+/* Sadly you can't repeat strings by multiplying them. Alternatives:
+ https://www.freecodecamp.org/news/three-ways-to-repeat-a-string-in-javascript-2a9053b93a2d/
+ */
+
+/* Dividing
+Multiply two values
+*/
+
+// Basic
+y = 5 / 2; // y: 2.5
+
+// Shortcut
+y = 64;
+y /= 2; // y: 32 (divides y by two)
+y /= 4; // y: 8 (divides y by four)
+
+/* Modulo
+Short modulo example:
+ 5 % 3 = 2 (3 fits inside 5 one time, 2 remaining)
+ 5 % 2 = 1 (2 fits inside 5 two times, 1 remaining)
+ 5 % 5 = 0 (5 fits inside 5 one time, 0 remaining)
+By modulo 2 you get 1 if the number is odd and 0 if it's even.
+*/
+
+// Basic
+y = 5 % 4; // y: 1
+
+// Shortcut
+y = 5;
+y %= 4; // y:1
+
+// Is y odd or even?
+y = 127;
+y %= 2; // y: 1 (1 => odd)
+
+y = 128;
+y %= 2; // y: 0 (0 => even)
+
+/* Power
+*/
+
+// Basic
+y = 5 ** 2; // y: 25
+
+// Shortcut
+y = 5;
+y **= 2; // y: 25```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/assignments_bitwise.md b/docs/JavaScript_Advance/assignments_bitwise.md
new file mode 100644
index 0000000..e538186
--- /dev/null
+++ b/docs/JavaScript_Advance/assignments_bitwise.md
@@ -0,0 +1,90 @@
+```js
+/* In javascript there are always several ways to the goal.
+Also the syntax of variable assignment can be abbreviated.
+This is also suitable for bitwise operations
+*/
+
+/* left shift
+*/
+
+// Basic
+y = 3; // y: 111 (binary)
+x = 2;
+y = y << x; // y: 11100 (binary)
+
+// Shortcut
+y = 3; // y: 111 (binary)
+x = 2;
+y <<= x; // y: 11100 (binary)
+
+/* right shift (sign preserving)
+*/
+
+// Basic
+y = -5; // y: 11111111111111111111111111111011 (binary)
+x = 1;
+y = y >> x; // y: 11111111111111111111111111111101 (binary) -3 (decimal)
+
+// Shortcut
+y = -5; // y: 11111111111111111111111111111011 (binary)
+x = 1;
+y >>= x; // y: 11111111111111111111111111111101 (binary) -3 (decimal)
+
+/* right shift (zero fill)
+*/
+
+// Basic
+y = 5; // y: 00000000000000000000000000000101 (binary)
+x = 1;
+y = y >>> x; // y: 00000000000000000000000000000010 (binary) 2 (decimal)
+
+// Shortcut
+y = 5; // y: 00000000000000000000000000000101 (binary)
+x = 1;
+y >>>= x; // y: 00000000000000000000000000000010 (binary) 2 (decimal)
+
+/* AND
+*/
+
+// Basic
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y = y & x; // y: 1000 (binary)
+
+// Shortcut
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y &= x; // y: 1000 (binary)
+
+/* OR
+*/
+
+// Basic
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y = y | x; // y: 1101 (binary)
+
+// Shortcut
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y |= x; // y: 1101 (binary)
+
+/* XOR
+*/
+
+// Basic
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y = y ^ x; // y: 0101 (binary)
+
+// Shortcut
+y = 12; // y: 1100 (binary)
+x = 9; // y: 1001 (binary)
+y ^= x; // y: 0101 (binary)
+
+/* NOT
+*/
+
+// Basic
+y = 5; // y: 00000000000000000000000000000101 (binary)
+y = ~y; // y: 11111111111111111111111111111010 (binary) -6 (decimal)```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/asyncAwait.md b/docs/JavaScript_Advance/asyncAwait.md
deleted file mode 100644
index 86a755b..0000000
--- a/docs/JavaScript_Advance/asyncAwait.md
+++ /dev/null
@@ -1 +0,0 @@
-# Async Await
\ No newline at end of file
diff --git a/JavaScript_Advance/asyncAwait.js b/docs/JavaScript_Advance/async_await.md
similarity index 99%
rename from JavaScript_Advance/asyncAwait.js
rename to docs/JavaScript_Advance/async_await.md
index d845455..e08d4ac 100644
--- a/JavaScript_Advance/asyncAwait.js
+++ b/docs/JavaScript_Advance/async_await.md
@@ -1,3 +1,4 @@
+```js
// Async Await Flow on JavaScript
// the most common case to use async await is to handle promises for fetch request
@@ -39,3 +40,4 @@ const getUsers = async () => {
console.log('DISPLAY AN ERROR', error)
}
}
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/bind.md b/docs/JavaScript_Advance/bind.md
index 8d69a83..d762f67 100644
--- a/docs/JavaScript_Advance/bind.md
+++ b/docs/JavaScript_Advance/bind.md
@@ -1,21 +1,19 @@
+```js
+/* The bind() method creates a new function that, when called, has its this keyword set
+to the provided value, with a given sequence of arguments preceding any provided
+when the new function is called.
+*/
+const module = {
+ x: 42,
+ getX: function () {
+ return this.x;
+ }
+};
-*The **bind()** method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.*
+const unboundGetX = module.getX;
+console.log(unboundGetX()); // The function gets invoked at the global scope
+// expected output: undefined
- let module = {
- x: 42,
- getX: function() {
- return this.x;
- }
- }
-
- let unboundGetX = module.getX;
-
- console.log(unboundGetX());
-
-> The above function gets invoked at the global scope
-> expected output: undefined
-
- let boundGetX = unboundGetX.bind(module);
- console.log(boundGetX());
-
-> expected output: 42
+const boundGetX = unboundGetX.bind(module);
+console.log(boundGetX());
+// expected output: 42```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/caesar_cipher.md b/docs/JavaScript_Advance/caesar_cipher.md
new file mode 100644
index 0000000..7a59c7c
--- /dev/null
+++ b/docs/JavaScript_Advance/caesar_cipher.md
@@ -0,0 +1,47 @@
+```js
+/**
+ * Most simplest encryption scheme. Read more: [http://practicalcryptography.com/ciphers/caesar-cipher/]
+ **/
+function caesarCipher (toEncipher, shift = 0) {
+ // If required for very strict shift checking then remove '=0'
+ if (Number.isNaN(Number(shift)) === true) {
+ throw new Error("Invalid Shift Provided");
+ } else {
+ shift = parseInt(Number(shift), 10);
+ }
+
+ if (typeof (toEncipher) === "string" || (typeof (toEncipher) === "number" && Number.isNaN(toEncipher) === false)) {
+ toEncipher = String(toEncipher);
+ } else {
+ throw new Error("Invalid string provided");
+ }
+
+ // These are the valid entries aacepted, you can change it according to requirements
+ const validEntries = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
+
+ shift %= validEntries.length;
+
+ let output = "";
+ for (const char of toEncipher) {
+ if (char === " ") {
+ output += " ";
+ continue;
+ // ------- If you donot want to accept invalid entries then uncomment below block
+ /*
+ ========================================================================================================
+ } else if (validEntries.indexOf(char) === -1) {return Error ('invalid character' + char)}
+ ========================================================================================================
+ and comment out the below block
+ */
+ //= ======================================================================================================
+ } else if (validEntries.indexOf(char) === -1) {
+ output += char;
+ continue;
+ }
+ //= ======================================================================================================
+ output += (validEntries.indexOf(char) + shift <= validEntries.length) ? validEntries[validEntries.indexOf(char) + shift] : validEntries[(validEntries.indexOf(char) + shift) % validEntries.length];
+ }
+ return output;
+}
+
+module.exports = caesarCipher;```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/callback.md b/docs/JavaScript_Advance/callback.md
index c180f11..a4caf49 100644
--- a/docs/JavaScript_Advance/callback.md
+++ b/docs/JavaScript_Advance/callback.md
@@ -1,144 +1,154 @@
+```js
+/**
+ * Callback functions are derived from a programming paradigm called
+ * `functional programming`. This basically can be concluded to this sentence:
+ * You can pass (`closure`) functions as an argument to another function.
+ *
+ * Higher order functions:- In javascript, functions can be used as value.
+ * We can assign function to a variable.
+ * Pass them as parameters to another functions.
+ * Return them from a function
+ *
+ * Callback:- We pass a function as parameters to another function, which calls/invokes
+ * the provided function. Hence the name Callback
+ *
+ *
+ *
+ * look at this example:
+ */
-Callback functions are derived from a programming paradigm called
-`functional programming`. This basically can be concluded to this sentence:
-You can pass (`closure`) functions as an argument to another function.
-
-look at this example:
-
-```javascript
const sayHi = (afterHi) => {
- console.log('Hi, ')
- return afterHi()
-}
+ console.log("Hi, ");
+ return afterHi();
+};
-sayHi(() => { console.log('How are you?') })
+sayHi(() => { console.log("How are you?"); });
// [out] 'Hi, '
// [out] 'How are you?'
-```
-
-
-If you look at the way we called `sayHi`, you will see that, we have not called
-the function which is going to print `'How are you?'`, we have not even named it (Anonymous function)
-This is the prototype of the function. The passed function, will act as if it has been defined
-inside the `sayHi` function. Therefore, you can assume that your function has access to the scope
-of the other function.
-
-example:
-
-```javascript
- const transformNumber = (num, operator) => {
- let test = 2;
- console.log(num)
- console.log(test)
- operator(num)
- console.log(num)
- console.log(test)
- }
-
- transformNumber(10, () => {
- num = num * num;
- test = 3
- })
- // [out] 10
- // [out] 2
- // [out] 100
- // [out] 3
-```
-
- One of very common uses of callback functions, is in `Promises`.
- I suggest you read `promises.js` file, before continuing this section.
- If you know about javascript `Promise` concept, you should be familiar with
- `.then()` and `.catch()` functions. These are `Promise`'s prototype methods.
- When a promise gets resolved (when `.resolve()` gets called), all the arguments
- passed to the `resolve()` function, will get passed to the function passed to `.then()`
- function. Look at the following example from MDN official documents:
-
- ```javascript
- var p1 = new Promise((resolve, reject) => {
- resolve('Success!');
- // or
- // reject(new Error("Error!"));
- });
-
- p1.then(value => {
- console.log(value); // Success!
- }, reason => {
- console.error(reason); // Error!
- });
-```
-
-So, basically the function that we pass to `.then()` function, is a `callback` function.
-
-We see usage of `Promise` widely in different API call scenarios.
-Different HTTP libraries (`fetch, axios, ...`), use javascript `Promise` object,
-for handling `onSuccess` and `onError` scenarios when calling an API endpoint.
-When you make an API call, if everything goes well and server's response has some
-2xx status code, this API call will be considered as `success` and otherwise, it has `failed`,
-and some `error` messages should be returned.
-In the following example, we are going to use `axios` as our HTTP library.
-But you can simulate the exact same scenario using any other HTTP libraries.
+/**
+ * If you look at the way we called `sayHi`, you will see that, we have not called
+ * the function which is going to print `'How are you?'`, we have not even named it (Anonymous function)
+ * This is the prototype of the function. The passed function, will act as if it has been defined
+ * inside the `sayHi` function. Therefore, you can assume that your function has access to the scope
+ * of the other function.
+ *
+ * example:
+ */
+
+const transformNumber = (num, operator) => {
+ const test = 2;
+ console.log(num);
+ console.log(test);
+ operator(num);
+ console.log(num);
+ console.log(test);
+};
+
+transformNumber(10, (num) => {
+ num = num * num;
+ test = 3;
+});
+// [out] 10
+// [out] 2
+// [out] 100
+// [out] 3
+
+/**
+ * One of very common uses of callback functions, is in `Promises`.
+ * I suggest you read `promises.js` file, before continuing this section.
+ * If you know about javascript `Promise` concept, you should be familiar with
+ * `.then()` and `.catch()` functions. These are `Promise`'s prototype methods.
+ * When a promise gets resolved (when `.resolve()` gets called), all the arguments
+ * passed to the `resolve()` function, will get passed to the function passed to `.then()`
+ * function. Look at the following example from MDN official documents:
+ */
+const p1 = new Promise((resolve, reject) => {
+ resolve("Success!");
+ // or
+ // reject(new Error("Error!"));
+});
+
+p1.then(value => {
+ console.log(value); // Success!
+}, reason => {
+ console.error(reason); // Error!
+});
+
+/**
+ * So, basically the function that we pass to `.then()` function, is a `callback` function.
+ *
+ * We see usage of `Promise` widely in different API call scenarios.
+ * Different HTTP libraries (`fetch, axios, ...`), use javascript `Promise` object,
+ * for handling `onSuccess` and `onError` scenarios when calling an API endpoint.
+ * When you make an API call, if everything goes well and server's response has some
+ * 2xx status code, this API call will be considered as `success` and otherwise, it has `failed`,
+ * and some `error` messages should be returned.
+ *
+ * In the following example, we are going to use `axios` as our HTTP library.
+ * But you can simulate the exact same scenario using any other HTTP libraries.
+ *
+ */
-
-```javascript
axios
- .get('https://cat-fact.herokuapp.com/facts/random')
+ .get("https://cat-fact.herokuapp.com/facts/random")
.then(response => {
- console.log(response, 'success!')
+ console.log(response, "success!");
})
.catch(error => {
- console.log(error, 'failed!')
- })
-```
-
-This process of making HTTP requests can get pretty much complicated.
-There are many cases that you need to make several API calls which each
-of them, will rely on the response from some previous requests.
-
-(In this tutorial, we are using the `cat-facts` public API to demonstrate
- different usages of HTTP libraries. You can read the documentation related
- to this API, here: https://alexwohlbruck.github.io/cat-facts/docs/)
-
-Let's say we want to retrieve 2 random facts about cats and after retrieving
-the list of 2 facts, start making another API call to retrieve details of each.
-
-According to `cat-facts` docs, we will receive an `_id` field in the list of facts
-and when we make an API call to `/facts/:id` endpoint, we can get details of that specific fact.
+ console.log(error, "failed!");
+ });
-Look at the following code snippet:
+/**
+ * This process of making HTTP requests can get pretty much complicated.
+ * There are many cases that you need to make several API calls which each
+ * of them, will rely on the response from some previous requests.
+ *
+ * (In this tutorial, we are using the `cat-facts` public API to demonstrate
+ * different usages of HTTP libraries. You can read the documentation related
+ * to this API, here: https://alexwohlbruck.github.io/cat-facts/docs/)
+ *
+ * Let's say we want to retrieve 2 random facts about cats and after retrieving
+ * the list of 2 facts, start making another API call to retrieve details of each.
+ *
+ * According to `cat-facts` docs, we will receive an `_id` field in the list of facts
+ * and when we make an API call to `/facts/:id` endpoint, we can get details of that specific fact.
+ *
+ * Look at the following code snippet:
+ */
-```javascript
axios({
- url: 'https://cat-fact.herokuapp.com/facts/random',
- method: 'GET',
- params: {animal_type: 'cat', amount: '2'}
+ url: "https://cat-fact.herokuapp.com/facts/random",
+ method: "GET",
+ params: { animal_type: "cat", amount: "2" }
}).then(response => {
- console.log('list success!')
+ console.log("list success!");
response.data.forEach((fact, idx) => {
axios
.get(`https://cat-fact.herokuapp.com/facts/${fact._id}`)
- .then(factRes => { console.log(`fact #${idx} success: `, factRes) })
- .catch(factErr => { console.log(`fact #${idx} failed: `, factErr) })
- })
+ .then(factRes => { console.log(`fact #${idx} success: `, factRes); })
+ .catch(factErr => { console.log(`fact #${idx} failed: `, factErr); });
+ });
}).catch(err => {
- console.log(err, 'list failed!')
-})
-```
-
-You can see that sometimes, we need to make API calls that rely on
-response of some other API call, therefore we need to make those calls
-in order, and also, if one of these API calls somewhere in this chain fails,
-we do not want to continue making next API calls.
-This specific scenario, can be extended in real lif usage of APIs. You might
-face some situations that you need to chain more than 4-5 API calls. In these
-cases, one will end up writing many nested `.then().catch()` blocks. Also,
-it is not True that we "Always" want to ignore making API calls next in chain,
-if one of requests in chain fails. So, different situations and more exceptions
-to handle and apparently, more nested `.then().catch()` code blocks.
-
-This situations is referred to as `Callbacks Hell`. It really can turn in to a
-mess, if you don't take cautions in writing your clean and readable using callback
-functions. To solve this issue, one might advise to use `async` `await` syntaxes,
-instead of using callback functions. This approach also have pros and cons. One of
-the cons of this approach, is instead of nested `.then()` blocks, you are going to
-need nested `try` `catch` blocks. Sometimes this kind of problems are inevitable.
+ console.log(err, "list failed!");
+});
+
+/**
+ * You can see that sometimes, we need to make API calls that rely on
+ * response of some other API call, therefore we need to make those calls
+ * in order, and also, if one of these API calls somewhere in this chain fails,
+ * we do not want to continue making next API calls.
+ * This specific scenario, can be extended in real lif usage of APIs. You might
+ * face some situations that you need to chain more than 4-5 API calls. In these
+ * cases, one will end up writing many nested `.then().catch()` blocks. Also,
+ * it is not True that we "Always" want to ignore making API calls next in chain,
+ * if one of requests in chain fails. So, different situations and more exceptions
+ * to handle and apparently, more nested `.then().catch()` code blocks.
+ *
+ * This situations is referred to as `Callbacks Hell`. It really can turn in to a
+ * mess, if you don't take cautions in writing your clean and readable using callback
+ * functions. To solve this issue, one might advise to use `async` `await` syntaxes,
+ * instead of using callback functions. This approach also have pros and cons. One of
+ * the cons of this approach, is instead of nested `.then()` blocks, you are going to
+ * need nested `try` `catch` blocks. Sometimes this kind of problems are inevitable.
+ */```
\ No newline at end of file
diff --git a/JavaScript_Basics/classes.js b/docs/JavaScript_Advance/classes.md
similarity index 96%
rename from JavaScript_Basics/classes.js
rename to docs/JavaScript_Advance/classes.md
index 84a8e82..d2c8ce6 100644
--- a/JavaScript_Basics/classes.js
+++ b/docs/JavaScript_Advance/classes.md
@@ -1,3 +1,4 @@
+```js
class Student {
// onlyname; // This should not have let or const only in classes
constructor (name, age) { // name and age are arguments given to object at the time of creation of object
@@ -25,4 +26,4 @@ class StudentInfo {
}
const SwapnilInfo = new StudentInfo("Swapnil Bio");
-SwapnilInfo.getNameAndCollege();
\ No newline at end of file
+SwapnilInfo.getNameAndCollege();```
\ No newline at end of file
diff --git a/JavaScript_Advance/closures.js b/docs/JavaScript_Advance/closures.md
similarity index 64%
rename from JavaScript_Advance/closures.js
rename to docs/JavaScript_Advance/closures.md
index 37b2a65..2483e9f 100644
--- a/JavaScript_Advance/closures.js
+++ b/docs/JavaScript_Advance/closures.md
@@ -1,26 +1,24 @@
-/*
-
-A closure is the combination of a function bundled together (enclosed)
-with references to its surrounding state (the lexical environment).
-In other words, a closure gives you access to an outer function’s scope from an inner function.
+```js
+/*
+A closure is the combination of a function bundled together (enclosed)
+with references to its surrounding state (the lexical environment).
+In other words, a closure gives you access to an outer function’s scope from an inner function.
In JavaScript, closures are created every time a function is created, at function creation time.
-
-
*/
-function modifyString(sampleString){
- const modifier = function(){
- const modifiedString = sampleString + ' is modified';
- return 'Original String: --->'+ sampleString + ', Modified String: ---> ' + modifiedString;
- }
- return modifier;
+function modifyString (sampleString) {
+ const modifier = function () {
+ const modifiedString = sampleString + " is modified";
+ return "Original String: --->" + sampleString + ", Modified String: ---> " + modifiedString;
+ };
+ return modifier;
}
-const modifier = modifyString('sample string');
+const modifier = modifyString("sample string");
/*
-function modifyString has two variables sampleString and modifier(function).
+function modifyString has two variables sampleString and modifier(function).
Now when modifyString is invoked, it returns modifier.
Usually, when a function is invoked, the memory allocated to the variables present inside gets freed
by the garbage collector. However, in javascript when a function returns another function
@@ -29,7 +27,5 @@ explains closures
*/
-console.log(modifier());
-// [out] Original String: --->sample string, Modified String: ---> sample string is modified
-
-
+console.log(modifier());
+// [out] Original String: --->sample string, Modified String: ---> sample string is modified```
\ No newline at end of file
diff --git a/JavaScript_Advance/connectToMongo.js b/docs/JavaScript_Advance/connect_to_mongo.md
similarity index 98%
rename from JavaScript_Advance/connectToMongo.js
rename to docs/JavaScript_Advance/connect_to_mongo.md
index c314469..b9a52bf 100644
--- a/JavaScript_Advance/connectToMongo.js
+++ b/docs/JavaScript_Advance/connect_to_mongo.md
@@ -1,3 +1,4 @@
+```js
const mongo = require("mongoose");
// protocol hostname port database
@@ -18,4 +19,4 @@ mongo.connection.on("error", (err) => {
// this code will also be executed once the script fails to connect to the mongodb.
console.error("---> Error handling option two: An error occurred. Please have a look at the stacktrace beyond.");
console.error(err);
-});
\ No newline at end of file
+});```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/cookies.md b/docs/JavaScript_Advance/cookies.md
index ce7470b..12c5754 100644
--- a/docs/JavaScript_Advance/cookies.md
+++ b/docs/JavaScript_Advance/cookies.md
@@ -1,34 +1,43 @@
-# Cookies
-
-## What are cookies?
-Cookies allow a JavaScript program to store data on the user's hard disk.
-
-A "spying" of the user hard disk is just as impossible as the placement of executable code. Because you write a cookie in a JavaScript, you can not specify where the cookie is stored to the user - this controls the browser of the user. In addition, cookies can not write uncontrolled amounts of data to the user's computer, but only a limited number of lines. Each such row defines a variable and assigns a value to that variable (name-value pairs). A cookie can therefore be compared with an entry in a configuration file - with the difference that the cookie can't change configuration data of the user's computer.
-
-## How to use cookies?
-
-### Write a cookie
-Cookies are saved as name-value pairs.
-`movie = Jungle Book`
-
-JavaScript can create, read, and delete cookies with the document.cookie property.
-With JavaScript, a cookie can be created like this:
-`document.cookie = "movie=Jungle Book;"`
-
-You can also specify when the cookie **expires** like this:
-`document.cookie = "movie=Jungle Book; expires=Thu, 18 Dec 2013 12:00:00 UTC"`
-
-You can also specify where the cookie belongs to with **path** like this:
-`document.cookie = "movie=Jungle Book; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/"`
-
-### Read a cookie
-To read a cookie you can use the following code, this will return all cookies saved by the browser:
-`var allCookies = document.cookie` returns e.g. movie=Jungle Book; cookie2=value; cookie3=value
-
-### Delete a cookie
-To delete a cookie you can use the following code, this will delete the cookie by a passed timestamp:
-`document.cookie = "movie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"`
-
-> You should define the cookie path to ensure that you delete the right cookie. Some browsers will not let you delete a cookie if you don't specify the path.
-
-[wiki]: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
+```js
+// #1 Simple usage of cookies
+document.cookie = "movie=Jungle Book";
+document.cookie = "actor=Balu";
+console.log("Simple usage:" + document.cookie);
+
+// #2 Get a cookie with the name 'actor'
+document.cookie = "movie=Jungle Book";
+document.cookie = "actor=Balu";
+const cookieValue = document.cookie.replace(/(?:(?:^|.*;\s*)actor\s*\=\s*([^;]*).*$)|^.*$/, "$1");
+console.log("Cookie with the name 'actor':" + cookieValue);
+
+// #3 Set cookie and execute code only once if cookie doesn't exist yet
+if (document.cookie.replace(/(?:(?:^|.*;\s*)doThisOnlyOnce\s*\=\s*([^;]*).*$)|^.*$/, "$1") !== "true") {
+ alert("Do something here!");
+ document.cookie = "doThisOnlyOnce=true; expires=Fri, 31 Dec 9999 23:59:59 GMT";
+}
+// Reset the previous code
+document.cookie = "doThisOnlyOnce=; expires=Thu, 01 Jan 1970 00:00:00 GMT";
+
+// #4 Check a cookie existence
+// ES5
+if (document.cookie.split(";").filter(function (item) {
+ return item.trim().indexOf("actor=") == 0;
+}).length) {
+ console.log("The cookie \"reader\" exists (ES5)");
+}
+// ES2016
+if (document.cookie.split(";").filter((item) => item.trim().startsWith("actor=")).length) {
+ console.log("The cookie \"actor\" exists (ES6)");
+}
+
+// #5 Check that a cookie has a specific value
+// ES5
+if (document.cookie.split(";").filter(function (item) {
+ return item.indexOf("actor=Balu") >= 0;
+}).length) {
+ console.log("The cookie \"actor\" has \"Balu\" for value (ES5)");
+}
+// ES2016
+if (document.cookie.split(";").filter((item) => item.includes("actor=Balu")).length) {
+ console.log("The cookie \"actor\" has \"Balu\" for value (ES6)");
+}```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/defaultValues.md b/docs/JavaScript_Advance/defaultValues.md
deleted file mode 100644
index 0541532..0000000
--- a/docs/JavaScript_Advance/defaultValues.md
+++ /dev/null
@@ -1 +0,0 @@
-# Default Values
diff --git a/docs/JavaScript_Advance/default_values.md b/docs/JavaScript_Advance/default_values.md
new file mode 100644
index 0000000..d5ba4ec
--- /dev/null
+++ b/docs/JavaScript_Advance/default_values.md
@@ -0,0 +1,30 @@
+```js
+/*
+A JavaScript function can have default parameter value.
+Using default function parameters, you can initialize parameters with default values.
+If you do not initialize a parameter with some value, then the default value of the parameter is undefined.
+*/
+
+const helpGST = (name, age) => {
+ console.log(name, age);
+};
+
+helpGST(); // Output will be undefined undefined
+
+const helpGSTWithDefaultValues = (name, age = 19) => {
+ console.log(name, age);
+};
+
+helpGSTWithDefaultValues("Swapnil"); // Output Swapnil 19
+
+helpGSTWithDefaultValues("Vishal", 23); // Output Vishal 23
+
+/*
+ You can also reuse default parameters to set another default parameter.
+*/
+
+const addOneToANumberAsDefault = (number1 = 1, number2 = number1 + 8) => {
+ console.log(number2);
+};
+
+addOneToANumberAsDefault(); // Output 9```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/destructuring.md b/docs/JavaScript_Advance/destructuring.md
index 6c74076..08613bf 100644
--- a/docs/JavaScript_Advance/destructuring.md
+++ b/docs/JavaScript_Advance/destructuring.md
@@ -1 +1,33 @@
-# Destructuring
+```js
+// As data coming from the server is very big then there is better way of getting the data out of object
+
+const a = { // Suppose this is the object coming from server then
+ name: "Swapnil",
+ age: 19,
+ college: "SIES"
+};
+
+// By using Destructuring we can get the data of specific keys out into variables
+
+const { name, age, college } = a; // This way name variable gets "Swapnil" this is possible because the object also has same key
+
+console.log(name); // Output Swapnil
+
+const { name: Myname } = a; // This way Myname variable get assigned the value of name key in from object a
+
+console.log(Myname); // Output Swapnil
+
+array = [1, 2, 3, 4]; // Array Declaration
+
+const [first, second, , fourth] = array; // Array Destructuring
+
+// In this the Order of variables matters the most as arrays don't have keys
+
+// For skipping some values we can do that using as shown here we have skipped the third value
+console.log(fourth); // Output 4
+
+newArray = ["Swapnil", 19, "Shinde"]; // New array
+
+const [firstName, , lastName] = newArray; // Destructured the firstName and lastName
+
+console.log(`My name is ${firstName} ${lastName}`);// Output My name is Swapnil Shinde```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/eventloop.md b/docs/JavaScript_Advance/eventloop.md
deleted file mode 100644
index c605107..0000000
--- a/docs/JavaScript_Advance/eventloop.md
+++ /dev/null
@@ -1 +0,0 @@
-# Event loop
diff --git a/docs/JavaScript_Advance/express.md b/docs/JavaScript_Advance/express.md
index a42433f..d1767d5 100644
--- a/docs/JavaScript_Advance/express.md
+++ b/docs/JavaScript_Advance/express.md
@@ -1,8 +1,15 @@
-#### install
-```sh
-npm i
-```
-#### run
-```sh
-node ./JavaScript_Advance/express.js
-```
\ No newline at end of file
+```js
+const express = require("express");
+
+const port = 3003;
+const app = express();
+
+const routes = express.Router();
+
+routes.get("/system_info", (req, res) => {
+ res.send("System on!");
+});
+
+app.use(express.json());
+app.use(routes);
+app.listen(port, () => console.log(`Server running in port ${port}`));```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/fsModule.md b/docs/JavaScript_Advance/fsModule.md
deleted file mode 100644
index 21adac6..0000000
--- a/docs/JavaScript_Advance/fsModule.md
+++ /dev/null
@@ -1 +0,0 @@
-# fs Module
diff --git a/docs/JavaScript_Advance/function_as_object.md b/docs/JavaScript_Advance/function_as_object.md
new file mode 100644
index 0000000..abe5e09
--- /dev/null
+++ b/docs/JavaScript_Advance/function_as_object.md
@@ -0,0 +1,15 @@
+```js
+/*
+Functions are special type of objects that has key-value pairs along with some code which gets executed
+*/
+
+function returnName (name) {
+ return name;
+}
+
+returnName.hiddenObj = {
+ name: "i am a javascript object"
+};
+
+console.log(returnName("hello")); // hello
+console.log(returnName.hiddenObj); // { name : 'i am a javascript object' }```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/generators.md b/docs/JavaScript_Advance/generators.md
new file mode 100644
index 0000000..c8fedb1
--- /dev/null
+++ b/docs/JavaScript_Advance/generators.md
@@ -0,0 +1,30 @@
+/*
+ Generators are functions with the possibility of exit and subsequent entry.
+ Their execution context (variable values) is preserved on subsequent inputs.
+*/
+
+// Let's consider a simple example:
+function* myGenerator() {
+ yield 5
+ yield 6
+}
+
+// In the example above, we wrote a simple generator function with asteriks(*) notation.
+// Next to the yield we put values that are going to be extracted from the function
+// In order to extract them one by one, we should at first call myGenerator function
+
+const gen = myGenerator()
+
+// The returning value of myGenerator function is a object-iterator. It has next() method
+// Which we may call to get the current generator function value:
+
+gen.next().value // 5
+
+// We get the value field of 'next' method's returning value, wich is an object as well
+// Let's call this again in order to get the next value:
+
+gen.next().value // 6
+
+// After we iterate through all the values, the next value is going to be undefined.
+
+gen.next().value // undefined.
diff --git a/docs/JavaScript_Advance/get_environment_variable.md b/docs/JavaScript_Advance/get_environment_variable.md
new file mode 100644
index 0000000..59e5783
--- /dev/null
+++ b/docs/JavaScript_Advance/get_environment_variable.md
@@ -0,0 +1,7 @@
+// Getting values of environment variables
+// For example, getting username of machine
+const ENV_VARIABLE_KEY = "USER";
+
+const ENV_VARIABLE_VALUE = process.env[ENV_VARIABLE_KEY];
+
+console.log(ENV_VARIABLE_VALUE);
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/hoisting.md b/docs/JavaScript_Advance/hoisting.md
index 777bc38..979fac4 100644
--- a/docs/JavaScript_Advance/hoisting.md
+++ b/docs/JavaScript_Advance/hoisting.md
@@ -1,30 +1,30 @@
-# what is hoisting?
-
-Basically, when Javascript compiles all of your code, all variable declarations using var are hoisted/lifted to the top of their functional/local scope (if declared inside a function) or to the top of their global scope (if declared outside of a function) regardless of where the actual declaration has been made. This is what we mean by “hoisting”.
-
-
-In JavaScript, a variable can be declared after it has been used. In other words; a variable can be used before it has been declared.
-
-Example 1 gives the same result as Example 2:
-```js
-Example 1 :
+/*
+Hoisting: Before executing any code, the javscript engine sets up memory for variables and functions.
+variables are assigned undefined by the engine.
+*/
+// Example 1
x = 5; // Assign 5 to x
elem = document.getElementById("demo"); // Find an element
-elem.innerHTML = x; // Display x in the element
+elem.innerHTML = x; // Display x in the element
var x; // Declare x
-```
-```js
-Example 2:
+
+// Example 2
var x; // Declare x
x = 5; // Assign 5 to x
elem = document.getElementById("demo"); // Find an element
-elem.innerHTML = x;
-```
+elem.innerHTML = x; // Display x in the element
+
+/* Conclusion :Example 1 gives the same result as Example 2
+so, Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope
+(to the top of the current script or the current function)
+*/
-To understand this, you have to understand the term "hoisting".
+console.log(foo);
+const foo = "foo"; // unable to print due to the hoisting behaviour
-Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function).
+console.log(ok);
+var ok = "this is printing";// var is hoisted
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/inheritance.md b/docs/JavaScript_Advance/inheritance.md
new file mode 100644
index 0000000..9c148f6
--- /dev/null
+++ b/docs/JavaScript_Advance/inheritance.md
@@ -0,0 +1,163 @@
+/*
+// ====================================
+// ====================================
+// BASE INHERITANCE EXAMPLE
+// ====================================
+// ====================================
+*/
+
+let baseObject = {
+ a: 1,
+ b: 2
+}
+
+// Create a new object with baseObject as the prototype for extendedObject.
+let extendedObject = Object.create(baseObject);
+
+// Define property c to the baseObject.
+// This is not explicitly defined on extendedObject
+// but is accessible via the [[Prototype]].
+baseObject.c = 3;
+
+// It appears that there are no properties on extendedObject
+console.log(extendedObject) // {}
+
+// a and b were defined on the baseObject.
+// The property looks up the prototype chain
+// until the properties of a and b exist or null is encountered for [[Prototype]].
+console.log(extendedObject.a); // 1
+console.log(extendedObject.b); // 2
+
+// Define d on the extendedObject
+// this is not accessible to the baseObject
+// as the [[Prototype]] inherits one way
+extendedObject.d = 4;
+
+// We now see property d on extendedObject
+console.log(extendedObject) // { d: 4 }
+
+// c is accessible because the prototype chain is "alive".
+// As properties are added or deleted, they can be accessed
+// by objects that share a prototype
+console.log(extendedObject.c); // 3
+
+// d is accessible on extendedObject where it was defined
+// but is inaccessible to baseObject and returns undefined
+console.log(extendedObject.d); // 4
+console.log(baseObject.d) // undefined
+
+
+/*
+// ====================================
+// ====================================
+// CLASS BASED INHERITANCE EXAMPLE
+// ====================================
+// ====================================
+*/
+
+// Animal class is defined with a property of legs and a method of getLegs
+// which returns the current value of legs.
+class Animal {
+ constructor () {
+ this.legs = 4;
+ }
+
+ getLegs () { // Function for getting legs
+ return (this.legs);
+ }
+}
+
+// Dog inherits the base properties from Animal
+// and adds its own property of age (which is not shared with Animal)
+// and the methods getAge and getSound
+class Dog extends Animal {
+ constructor (age) {
+
+ // We need to call super in order to instantiate the constructor on Animal.
+ // If super is not called, then legs would be inaccessible to the Dog class
+ super();
+ this.age = age;
+ }
+
+ getSound () {
+ return ("Bow");
+ }
+
+ getAge () {
+ return (this.age);
+ }
+}
+
+ // Create a new Dog object passing in 10 for the age parameter
+const tommy = new Dog(10);
+
+// Since the Dog class extends the Animal class
+// tommy has access to the getLegs method
+console.log(tommy.getLegs()); // Output 4
+
+console.log(tommy.getSound()); // Bow
+
+console.log(tommy.getAge()); // 10
+
+
+/*
+// ====================================
+// ====================================
+// Function Based Inheritance Example
+// ====================================
+// ====================================
+*/
+
+// This function defines the base "constructor" for us and is
+// comparable to the constructor function found in the class example
+function Animal() {
+ this.legs = 4;
+}
+
+// Adding the getLegs property to the prototype ensures that
+// it will be inherited to any objects that are created from Animal
+Animal.prototype.getLegs = function() {
+ return this.legs;
+}
+
+// The Dog function acts as the constructor, but where is the super call
+// that we use to call the constructor from Animal?
+function Dog(age) {
+ // the call method is similar in function to calling the super method in the
+ // super method in the class based example. In this case, it instantiates the
+ // legs property
+ Animal.call(this);
+
+ this.age = age;
+}
+
+// We set the prototype of Dog to the prototype of Animal
+// in order to have access to the getLegs method that is
+// defined on Animal's prototype
+Dog.prototype = Object.create(Animal.prototype);
+
+// Dog is set as the constructor property on the Dog prototype to
+// match the object structure of the class example
+Dog.prototype.constructor = Dog;
+
+// Define getSound method
+Dog.prototype.getSound = function() {
+ return ("Bow");
+}
+
+// Define getAge method
+Dog.prototype.getAge = function() {
+ return (this.age);
+}
+
+// create new Dog with age 10
+const tommy = new Dog(10);
+
+console.log(tommy); // Dog { legs: 4, age: 10 }
+
+// call getLegs that was inherited from Animal
+console.log(tommy.getLegs()); // 4
+
+// call both getSound and getAge that are defined on Dog
+console.log(tommy.getSound()); // Bow
+console.log(tommy.getAge()); // 10
diff --git a/JavaScript_Advance/jsonParseAndStringify.js b/docs/JavaScript_Advance/json_parse_and_stringify.md
similarity index 100%
rename from JavaScript_Advance/jsonParseAndStringify.js
rename to docs/JavaScript_Advance/json_parse_and_stringify.md
diff --git a/docs/JavaScript_Advance/keys.md b/docs/JavaScript_Advance/keys.md
new file mode 100644
index 0000000..aa5f297
--- /dev/null
+++ b/docs/JavaScript_Advance/keys.md
@@ -0,0 +1,45 @@
+// Object.keys() is a useful way of checking a javascrip object's enumerable property names.
+// This object method returns an array of the property names.
+
+var exampleObject = {
+ a: "apple",
+ b: "boat",
+ c: "car"
+};
+
+console.log(Object.keys(exampleObject));
+// expected output: ["a", "b", "c"]
+
+// Object.keys() can also be used on Arrays
+
+var exampleArray = ["a", "b", "c"];
+
+console.log(Object.keys(exampleArray));
+// expected output: ["0", "1", "2"]
+
+// Object.keys() can be useful in combination with array methods
+
+Object.keys(exampleObject).forEach((propertyName) => {
+ // your fancy logic here
+});
+
+// Such as
+
+var funExampleObject = {
+ look: "at",
+ all: "of",
+ the: "fine",
+ grained: "control",
+ you: "have",
+ with: "Object.keys()!"
+};
+
+var funExampleResult = [];
+
+Object.keys(funExampleObject).forEach((propertyName) => {
+ funExampleResult.push(propertyName);
+ funExampleResult.push(funExampleObject[propertyName]);
+});
+
+console.log(funExampleResult.join(" "));
+// expected output: "look at all of the fine grained control you have wiht Object.keys()!"
diff --git a/docs/JavaScript_Advance/map_object.md b/docs/JavaScript_Advance/map_object.md
new file mode 100644
index 0000000..3cc2e30
--- /dev/null
+++ b/docs/JavaScript_Advance/map_object.md
@@ -0,0 +1,106 @@
+/*
+Map : Object
+Maps allow associating keys and values similar to normal Objects except Maps allow any Object to be used as a
+key instead of just Strings and Symbols. Maps use get() and set() methods to access the values stored in the Map.
+A Map are often called a HashTable or a Dictionary in other languages.
+*/
+
+const map = new Map();
+
+map.set("1", "str1"); // a string key
+map.set(1, "num1"); // a numeric key
+map.set(true, "bool1"); // a boolean key
+
+// remember the regular Object? it would convert keys to string
+// Map keeps the type, so these two are different:
+alert(map.get(1)); // 'num1'
+alert(map.get("1")); // 'str1'
+
+alert(map.size); // 3
+
+// Map can also use objects as keys.
+
+const john = {
+ name: "John"
+};
+
+// for every user, let's store their visits count
+const visitsCountMap = new Map();
+
+// john is the key for the map
+visitsCountMap.set(john, 123);
+
+alert(visitsCountMap.get(john)); // 123
+/*
+Iteration over Map
+For looping over a map, there are 3 methods:
+
+map.keys() – returns an iterable for keys,
+map.values() – returns an iterable for values,
+map.entries()
+*/
+
+const recipeMap = new Map([
+ ["cucumber", 500],
+ ["tomatoes", 350],
+ ["onion", 50]
+]);
+
+// iterate over keys (vegetables)
+for (const vegetable of recipeMap.keys()) {
+ alert(vegetable); // cucumber, tomatoes, onion
+}
+
+// iterate over values (amounts)
+for (const amount of recipeMap.values()) {
+ alert(amount); // 500, 350, 50
+}
+
+// iterate over [key, value] entries
+for (const entry of recipeMap) { // the same as of recipeMap.entries()
+ alert(entry); // cucumber,500 (and so on)
+}
+
+/*
+Loop with forEach
+Instead of using for loop, forEach can be used.
+
+map.forEach(function(value, key){
+
+});
+
+or with array function
+
+map.forEach((value, key) => {
+
+})
+
+*/
+
+recipeMap.forEach((value, key) => {
+ alter(key + " = " + value);
+});
+
+/*
+Convert To Arrays
+A map obejct can be convert to arrays
+
+var array = Array.from(map) - create an array of the key-value pairs
+
+var array = Array.from(map.value()) - Create an array of the values
+
+var array = Array.from(map.key()) - Create an array of the keys
+
+*/
+
+// create an array of the key-value pairs
+const keyValArr = Array.from(recipeMap);
+alter(keyValArr);
+
+// Create an array of the values
+const ValArr = Array.from(recipeMap);
+alter(ValArr);
+
+// Create an array of the keys
+const keyArr = Array.from(recipeMap);
+alter(keyArr);
\ No newline at end of file
diff --git a/JavaScript_Advance/nasaimgHttps.js b/docs/JavaScript_Advance/nasaimg_https.md
similarity index 100%
rename from JavaScript_Advance/nasaimgHttps.js
rename to docs/JavaScript_Advance/nasaimg_https.md
diff --git a/docs/JavaScript_Advance/object_assign.md b/docs/JavaScript_Advance/object_assign.md
new file mode 100644
index 0000000..feeded1
--- /dev/null
+++ b/docs/JavaScript_Advance/object_assign.md
@@ -0,0 +1,45 @@
+// Object.assign() is a useful method for copying objects in javascript. This method can be useful when mutating data in javascript.
+// Object.assign() accepts two parameters: a target object and source objects.
+
+// Problem statement
+var object1 = {
+ thing1: "thing1's things",
+ thing2: "thing2's things"
+};
+
+var object2 = object1;
+
+object2.thing1 = "thing1's new things";
+
+console.log(object1);
+// expected output: { thing1: "thing1's new things", thing2: "thing2's things" }
+console.log(object2);
+// expected output: { thing1: "thing1's new things", thing2: "thing2's things" }
+
+object2 = Object.assign({}, object1);
+
+object2.thing2 = "thing2's new things";
+
+console.log(object1);
+// expected output: { thing1: "thing1's new things", thing2: "thing2's things" }
+console.log(object2);
+// expected output: { thing1: "thing1's new things", thing2: "thing2's new things" }
+
+// it is worth noting that Object.assign() will not perform a deep copy of your entire object. For this, the following is useful:
+
+var object2 = JSON.parse(JSON.stringify(object1));
+
+// Object.assign() can also be used for merging objects
+
+var newObject1 = {
+ a: "1"
+};
+
+var newObject2 = {
+ b: "2"
+};
+
+Object.assign(newObject1, newObject2);
+
+console.log(newObject1);
+// expected output: { a: "1", b: "2" }
diff --git a/docs/JavaScript_Advance/polymorphism.md b/docs/JavaScript_Advance/polymorphism.md
index f73a80b..41e0d67 100644
--- a/docs/JavaScript_Advance/polymorphism.md
+++ b/docs/JavaScript_Advance/polymorphism.md
@@ -1,63 +1,44 @@
-# Polymorphism
-Polymorphism is one of the basic principles of **object-oriented programming (OOP)**. It is the practice of designing objects to share behavior and be able to overwrite common behaviors associated with specific ones. Polymorphism uses inheritance to realize this.
+// Polymorphism is one of the basic principles of object-oriented programming (OOP)
+// It is the practice of designing objects to share behavior and be able to overwrite common behaviors associated with specific ones.
-*Related: [Inheritance](JavaScript_Basics/inheritance.md), [Classes](JavaScript_Basics/classes.md)*
-
-## Parent class
-Let's create a `class` called Person first.
-```javascript
+// First create the class Person
class Person {
- constructor(name) {
- this.name = name;
- }
+ constructor (name) {
+ this.name = name;
+ }
- getName() {
- return this.name
- }
+ getName () {
+ return this.name;
+ }
- getPosition() {
- return "Unemployed";
- }
+ getPosition () {
+ return "Unemployed";
+ }
}
-```
-## Child class
-We like to extend this `class` for Employees. This can be done by creating a `class` and adding `extends`.
-```javascript
+// Extend the class Person with Employee
class Employee extends Person {
- constructor(name, position, salary) {
- super(name); // super() calls the constructor of Person
-
- this.position = position;
- this.salary = salary;
- }
-
- getPosition() { //overwrites the method of person
- return this.position
- }
-
- getSalary() {
- return this.salary
- }
+ constructor (name, position, salary) {
+ super(name); // super() calls the constructor of Person
+
+ this.position = position;
+ this.salary = salary;
+ }
+
+ getPosition () { // overwrites the method of person
+ return this.position;
+ }
+
+ getSalary () {
+ return this.salary;
+ }
}
-```
-## Output
-As you can see in the output below, `getPosition()` gets overwritten in `Employee` and `getName()` can be used from `Person` in `Employee`
-```javascript
-let person = new Person("James");
-let employee = new Employee("Torsten", "Developer", 45000);
+const person = new Person("James");
+const employee = new Employee("Torsten", "Developer", 45000);
console.log(employee.getName()); // Output: Torsten
console.log(person.getName()); // Output: James
console.log(employee.getPosition()); // Output: Developer
-console.log(person.getPosition()); // Output: Unemployed
-```
-
-The above example describes the polymorphism in ECMAScript.
-An object "Person" can be described in many forms (e.g. Employee, ...).
-
-Another example from reality about polymorphism:
-
-When I mention an Asian person, it is very abstract. It can be Japanese, Vietnamese or Indian. But they all share the typical characteristics of Asians.
\ No newline at end of file
+console.log(person.getPosition()); // Output: Unemployed
\ No newline at end of file
diff --git a/JavaScript_Advance/postgresConnection.js b/docs/JavaScript_Advance/postgres_connection.md
similarity index 100%
rename from JavaScript_Advance/postgresConnection.js
rename to docs/JavaScript_Advance/postgres_connection.md
diff --git a/docs/JavaScript_Advance/promises.md b/docs/JavaScript_Advance/promises.md
index f6b2ea7..d2af04b 100644
--- a/docs/JavaScript_Advance/promises.md
+++ b/docs/JavaScript_Advance/promises.md
@@ -1,69 +1,48 @@
-# Promises
-
-Promises provide a more convenient syntax to handle asynchronous operations without wanting to tear your hair out.
-
-Consider this example, pre promises:
-```javascript
-// Assume we have a number of async operations that need to run in sequence - we need the result to grab the next result.
+// Promises provide a more convenient syntax to handle asynchronous operations without wanting to tear your hair out.
+// Consider this example, pre promises:
const getAsyncDataWithCallbacks = (string, cb) => {
setTimeout(() => {
cb(`${string} bar`);
}, 1000);
};
-getAsyncDataWithCallbacks('foo', firstResult => {
+// Assume we have a number of async operations that need to run in sequence - we need the result to grab the next result.
+getAsyncDataWithCallbacks("foo", firstResult => {
getAsyncDataWithCallbacks(firstResult, secondResult => {
getAsyncDataWithCallbacks(secondResult, thirdResult => {
- //on and on and on...
- })
+ // on and on and on...
+ });
});
});
-```
-
-Notice the nested layers of callbacks - callbacks inside of callbacks. This is commonly referred to as "callback hell" -
-where we have too many callbacks to the point of making our code unmanageable.
-
-This is eased via the use of promises. You can change these async calls to return a promise instead that wraps that value like so:
-```javascript
+// This is eased via the use of promises. You can change these async calls to return a promise instead that wraps that value like so:
const getAsyncDataWithPromises = string => {
return new Promise((resolve, reject) => {
- //Assume an async operation here. We'll set a timeout to give an example.
- //After 5 seconds, our data will resolve.
+ // Assume an async operation here. We'll set a timeout to give an example.
+ // After 5 seconds, our data will resolve.
setTimeout(() => resolve(`${string} bar`), 1000);
});
};
-```
-Our callback chaining above instead now becomes:
-
-```javascript
-getAsyncDataWithPromises('foo')
+getAsyncDataWithPromises("foo")
.then(firstSet => getAsyncDataWithPromises(firstSet))
.then(secondSet => getAsyncDataWithPromises(secondSet));
- //... etc. etc. etc.
+// ... etc. etc. etc.
// Or, a more simplified version using references
-getAsyncDataWithPromises('foo')
+getAsyncDataWithPromises("foo")
.then(getAsyncDataWithPromises)
.then(getAsyncDataWithPromises);
-```
-
-As shown above, using promises allows us to create "chains" of asynchronous operations that can be run one after another.
-`then` will not be called until a promise's value is resolved. `catch` will only be called if something goes wrong.
-````javascript
-getAsyncData()
+// As shown above, using promises allows us to create "chains" of asynchronous operations that can be run one after another.
+// `then` will not be called until a promise's value is resolved. `catch` will only be called if something goes wrong.
+getAsyncDataWithPromises()
.then(data => {
- //... use data
+ // ... use data
}).catch(e => {
- //... handle exception
+ // ... handle exception
});
-````
-
-Some further examples:
-```javascript
// promises promise the nodejs main thread that i'm going to come after doing a particular task
const a = new Promise((resolve, reject) => { // This is a empty promise
@@ -99,4 +78,24 @@ asyncCall
.then(val => `${val} bar`)
// console logs 'foo bar'
.then(console.log);
-```
\ No newline at end of file
+
+// promise.all();\
+const fs = require("fs");
+const dir = __dirname + "/text/";
+const promisesarray = ["Text file content start after this : "];
+function readfile () {
+ fs.readdir(dir, "utf-8", (err, File) => {
+ File.forEach(file => {
+ promisesarray.push(new Promise((resolve, reject) => {
+ fs.readFile(dir + file, "utf-8", (err, data) => {
+ if (err) reject(err);
+ else resolve(data);
+ });
+ }));
+ });
+ Promise.all(promisesarray).then(data => {
+ console.log(data);
+ });
+ });
+}
+readfile();
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/prototype.md b/docs/JavaScript_Advance/prototype.md
index 140ce77..56fc572 100644
--- a/docs/JavaScript_Advance/prototype.md
+++ b/docs/JavaScript_Advance/prototype.md
@@ -1 +1,48 @@
-# Prototype
\ No newline at end of file
+// Prototypes are an extension for objects in javascript
+// we use to encapsulate certain functionality to an Object (like a Class)
+
+// first create an Object Person
+// that receive the name and lastName
+
+function Person (firstName, lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+}
+
+// We user the prototype keyword to add some functionality to this Person Object
+
+// add a method getName that return the name
+Person.prototype.getName = function () {
+ return this.firstName;
+};
+
+// add a method getLastName that return the lastName
+Person.prototype.getLastName = function () {
+ return this.lastName;
+};
+
+// add a method getFullName that return the name + lastName
+Person.prototype.getFullName = function () {
+ return this.firstName + " " + this.lastName;
+};
+
+// add a method getFormalName
+Person.prototype.getFormalName = function () {
+ return this.lastName + ", " + this.firstName;
+};
+
+// these methods appear in the __proto__ property of an Object instance of Person
+
+const max = new Person("Max", "Payne");
+
+console.log(max.getName());
+// [out] Max
+
+console.log(max.getLastName());
+// [out] Payne
+
+console.log(max.getFullName());
+// [out] Max Payne
+
+console.log(max.getFormalName());
+// [out] Payne, Max
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/recursion.md b/docs/JavaScript_Advance/recursion.md
new file mode 100644
index 0000000..cd82f7f
--- /dev/null
+++ b/docs/JavaScript_Advance/recursion.md
@@ -0,0 +1,32 @@
+// Recursion is when a function calls itself.
+// Recursion gives us an interesting way to write algorithms that can solve complicated problems.
+
+// Take for example factorials which is just an integer times each of the integers below it: so 5 factorial (also written 5!) is just 5 * 4 * 3 * 2 * 1.
+// If we want to write an algorithm that can calculate the factorial of any given number without using recursion, we could do something like this:
+
+function calcuateFactorialWithoutRecursion (num) {
+ let total = num;
+ let nextNumber = num - 1;
+ while (nextNumber >= 1) {
+ total = total * nextNumber;
+ nextNumber--; // decrease the next number by 1
+ }
+ return total;
+}
+
+// calcuateFactorialWithoutRecursion(5) // 120
+// 5 * 4 * 3 * 2 * 1 = 120
+
+// We can write the same function this way using recursion:
+function calculateFactorialWithRecursion (num) {
+ if (num === 1) { // This step is critical. The num parameter will keep decreasing until it gets to 1.
+ // Once the function gets called with 1 as a parameter, the function will return without calling itself.
+ return num;
+ }
+ return num * calculateFactorialWithRecursion(num - 1);
+}
+
+calculateFactorialWithRecursion(7); // 5040
+// 7 * 6 * 5 * 4 * 3 * 2 * 1 = 5040
+
+// See how clean recursion made this algorithm!
\ No newline at end of file
diff --git a/JavaScript_Basics/regex.js b/docs/JavaScript_Advance/regex.md
similarity index 100%
rename from JavaScript_Basics/regex.js
rename to docs/JavaScript_Advance/regex.md
diff --git a/JavaScript_Advance/resources/file/order.txt b/docs/JavaScript_Advance/resources/file/order.txt
similarity index 100%
rename from JavaScript_Advance/resources/file/order.txt
rename to docs/JavaScript_Advance/resources/file/order.txt
diff --git a/JavaScript_Advance/resources/img/file.jpg b/docs/JavaScript_Advance/resources/img/file.jpg
similarity index 100%
rename from JavaScript_Advance/resources/img/file.jpg
rename to docs/JavaScript_Advance/resources/img/file.jpg
diff --git a/docs/JavaScript_Advance/set_function.md b/docs/JavaScript_Advance/set_function.md
new file mode 100644
index 0000000..35677f6
--- /dev/null
+++ b/docs/JavaScript_Advance/set_function.md
@@ -0,0 +1,12 @@
+const jobs = {
+ set current (jobName) {
+ this.jobArray.push(jobName);
+ },
+ jobArray: []
+};
+
+language.current = "Plumber";
+language.current = "Architect";
+
+console.log(language.log);
+// expected output: Array ["Plumber", "Architect"]
\ No newline at end of file
diff --git a/JavaScript_Advance/set-object.js b/docs/JavaScript_Advance/set_object.md
similarity index 55%
rename from JavaScript_Advance/set-object.js
rename to docs/JavaScript_Advance/set_object.md
index b53d123..a513294 100644
--- a/JavaScript_Advance/set-object.js
+++ b/docs/JavaScript_Advance/set_object.md
@@ -4,14 +4,14 @@ const testSet = new Set([1, 2, "orange", { name: "Frank" }]);
// Instance Methods and Properties
-console.log(testSet.size); // output: 4
+console.log(testSet.size); // output: 4
-testSet.add(4); // testSet [1, 2, "orange", {name: "Frank"}, 4]
-testSet.add(4); // Value not added, it's duplicated
-testSet.delete(2); // testSet [1, "orange", {name: "Frank"}, 4]
-testSet.has(1); // Return true
+testSet.add(4); // testSet [1, 2, "orange", {name: "Frank"}, 4]
+testSet.add(4); // Value not added, it's duplicated
+testSet.delete(2); // testSet [1, "orange", {name: "Frank"}, 4]
+testSet.has(1); // Return true
testSet.has({ name: "Frank" }); // Return false, because the use of "==="
-testSet.clear(); // testSet []
+testSet.clear(); // testSet []
// Iterating Sets
@@ -19,10 +19,10 @@ const iterSet = new Set([1, "blue", 125, "right"]);
// Using for..of
-for (let item of iterSet) console.log(item); // output: 1, "blue", 125, "right"
-for (let item of iterSet.keys()) console.log(item); // same output
-for (let item of iterSet.values()) console.log(item); // same output
-for (let item of iterSet.entries()) console.log(item); // output: [1, 1], ["blue", "blue"], ...etc
+for (const item of iterSet) console.log(item); // output: 1, "blue", 125, "right"
+for (const item of iterSet.keys()) console.log(item); // same output
+for (const item of iterSet.values()) console.log(item); // same output
+for (const item of iterSet.entries()) console.log(item); // output: [1, 1], ["blue", "blue"], ...etc
// Using for..each
@@ -31,7 +31,7 @@ iterSet.forEach(value => console.log(value)); // output: 1, "blue", 125, "right"
// Creating a Set from an Array
const array = [1, 2, 3, "Alehop"];
-const arrToSet = new Set(array);
+const arrToSet = new Set(array);
console.log(arrToSet); // output: [1, 2, 3, "Alehop"]
@@ -45,7 +45,7 @@ console.log(notDupArray); // output: [1, 2, "yes", "no", 69, 420]
// Creating a Set form an String
const text = "Nice";
-const strToSet = new Set(text);
+const strToSet = new Set(text);
console.log(strToSet); // output: ["N", "i", "c", "e"]
@@ -54,5 +54,4 @@ console.log(strToSet); // output: ["N", "i", "c", "e"]
const dupText = "Niceeee";
const notDupText = [...new Set(dupText)].join("");
-console.log(notDupText); // output: "Nice"
-
+console.log(notDupText); // output: "Nice"
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/some_method.md b/docs/JavaScript_Advance/some_method.md
new file mode 100644
index 0000000..94bde76
--- /dev/null
+++ b/docs/JavaScript_Advance/some_method.md
@@ -0,0 +1,18 @@
+// Array some() Method
+// The some() method executes the function once for each element present in the array:
+// If it finds an array element where the function returns a true value,
+// some() returns true (and does not check the remaining values)
+
+const arr = ["name", "test name", "testtwo", "ship"];
+
+// syntax
+
+const found = arr.some((element) => {
+ console.log(element); // nam ,test name, true; stop iterating
+ // if the condition matched it doesn't check for the whole array
+ // beneficial where you want to check if a property in a whole array exist
+ return element.includes("test");
+});
+console.log(found); // true
+
+// it doesn't change the original array
\ No newline at end of file
diff --git a/docs/JavaScript_Advance/spread&rest.md b/docs/JavaScript_Advance/spread&rest.md
deleted file mode 100644
index cc776fc..0000000
--- a/docs/JavaScript_Advance/spread&rest.md
+++ /dev/null
@@ -1 +0,0 @@
-# Spread & Rest
diff --git a/JavaScript_Advance/spread&rest.js b/docs/JavaScript_Advance/spread_&_rest.md
similarity index 100%
rename from JavaScript_Advance/spread&rest.js
rename to docs/JavaScript_Advance/spread_&_rest.md
diff --git a/docs/JavaScript_Advance/timerFunction.md b/docs/JavaScript_Advance/timerFunction.md
deleted file mode 100644
index 9e53e69..0000000
--- a/docs/JavaScript_Advance/timerFunction.md
+++ /dev/null
@@ -1 +0,0 @@
-# Timer Function
diff --git a/JavaScript_Advance/tryCatch.js b/docs/JavaScript_Advance/try_catch.md
similarity index 58%
rename from JavaScript_Advance/tryCatch.js
rename to docs/JavaScript_Advance/try_catch.md
index 038eff2..0192d79 100644
--- a/JavaScript_Advance/tryCatch.js
+++ b/docs/JavaScript_Advance/try_catch.md
@@ -71,4 +71,76 @@ try {
SyntaxError A syntax error has occurred
TypeError A type error has occurred
URIError An error in encodeURI() has occurred
-*/
\ No newline at end of file
+*/
+
+//Try and Catch
+
+/* In JavaScript, try/catch/finally** statement handle errors that may occur in the block.
+
+try statement eables you to test your code in the block.
+catch statement enables you to execute a block of code when it catches an error.
+finally statement enables you to execute always after try and catch, regardless of an exception was thrown or caught.
+*/
+
+
+// Syntax
+
+try {
+ throw 'exception'; // generate an exception
+} catch (error) {
+ // statements to handle any exceptions
+} finally {
+ // always runs regardless of the resulf ot try/catch
+}
+
+
+// Errors
+
+// Reference Error
+
+try {
+ hello(); // hello is not defined so it will cause a reference errorr
+} catch (error) {
+ console.log(error);
+} finally {
+ console.log('Finally runs reguardess of the reuslt');
+}
+
+
+// Type Error
+
+try {
+ null.hello(); // hello is not defined so it will cause a reference errorr
+} catch (error) {
+ console.log("You cannot call from null");
+} finally {
+ console.log('Finally runs reguardess of the reuslt');
+}
+
+
+// Syntax Error
+
+try {
+ eval('2+2'); // thsi works fine
+ eval('Hello, World!'); // this will generate error
+} catch (error) {
+ console.log("Syntax error");
+} finally {
+ console.log('Finally runs reguardess of the reuslt');
+}
+
+
+// User Defined Error
+
+const person = {name:John, age: 23};
+
+try {
+ if(!person.gender){
+ // throw 'person has no gender'
+ throw new SyntaxError('Person has no gender');
+ }
+} catch (error) {
+ console.log("You cannot call from null");
+} finally {
+ console.log('Finally runs reguardess of the reuslt');
+}
diff --git a/docs/JavaScript_Advance_Info/AJAX.md b/docs/JavaScript_Advance_Info/AJAX.md
new file mode 100644
index 0000000..44c967a
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/AJAX.md
@@ -0,0 +1,48 @@
+# AJAX
+
+AJAX stands for **A**synchronous **J**avaScript **A**nd **X**ML. In a nutshell, it is the use of the XMLHttpRequest object to communicate with servers. It can send and receive information in various formats, including JSON, XML, HTML, and text files. AJAX’s most appealing characteristic is its "asynchronous" nature, which means it can communicate with the server, exchange data, and update the page without having to refresh the page.
+
+The two major features of AJAX allow you to do the following:
+
+- Make requests to the server without reloading the page
+- Receive and work with data from the server
+
+In a traditional web application, HTTP requests, that are initiated by the user's interaction with the web interface, are made to a web server. The web server processes the request and returns an HTML page to the client. During HTTP transport, the user is unable to interact with the web application.
+
+
+In an Ajax web application, the user is not interrupted in interactions with the web application. The Ajax engine or JavaScript interpreter enables the user to interact with the web application independent of HTTP transport to and from the server by rendering the interface and handling communications with the server on the user's behalf.
+
+
+Example:
+```html
+
+
+
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/BOM_functions.md b/docs/JavaScript_Advance_Info/BOM_functions.md
new file mode 100644
index 0000000..8801798
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/BOM_functions.md
@@ -0,0 +1,79 @@
+## History API [MDN](https://developer.mozilla.org/ru/docs/Web/API/History)
+
+Interface manipulates browser history in the session borders
+
+Fields
+
+- {length} integer amount of elements in session history
+- {state} field stories state existed page
+
+Methods
+
+- {go} method loads a page from the session history with integer args
+- {back} method goes to the previous page in session history the same as history.go(-1)
+- {forfard} method goes to the next page in session history the same as history.go(1)
+- {pushState} method pushes the given data onto the session history stack with the specified title and, if provided, URL
+- {replaceState} updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL
+
+## Navigator API [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Navigator)
+
+provides the user-agent information
+
+- {userAgent} user agent string for the current browser
+- {language} language of the browser UI
+- {languages} list of languages known to the user
+
+Also contains a lot of user-agent information related to:
+
+- media devices
+- bluetooth
+- usb
+- geo location
+ -- etc.
+
+##### {serviceWorker} provides access to registration, removal, upgrade, and communication with service worker
+
+## Screen [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Screen)
+
+```javascript
+// Screen data sample:
+console.log(screen);
+/**
+ * {
+ * availHeight: 949,
+ * availLeft: 0,
+ * availTop: 23,
+ * availWidth: 1680,
+ * colorDepth: 24,
+ * height: 1050,
+ * orientation: {angle: 0, type: "landscape-primary", onchange: null}
+ * pixelDepth: 24,
+ * width: 1680,
+ * }
+ */
+```
+
+## Location [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Location)
+
+```javascript
+// Location data sample
+// -> https://developer.mozilla.org/en-US/docs/Web/API/Location?replace=true
+console.log(location);
+/**
+ * {
+ * ancestorOrigins: DOMStringList {length: 0},
+ * assign: ƒ assign(),
+ * hash: "",
+ * host: "developer.mozilla.org",
+ * hostname: "developer.mozilla.org",
+ * href: "https://developer.mozilla.org/en-US/docs/Web/API/Location?replace=true",
+ * origin: "https://developer.mozilla.org",
+ * pathname: "/en-US/docs/Web/API/Location",
+ * port: "",
+ * protocol: "https:",
+ * reload: ƒ reload(),
+ * replace: ƒ (),
+ * search: "?replace=true"
+ * }
+ */
+```
diff --git a/docs/JavaScript_Advance_Info/JSON.md b/docs/JavaScript_Advance_Info/JSON.md
new file mode 100644
index 0000000..03b6f58
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/JSON.md
@@ -0,0 +1,14 @@
+# JSON
+JSON is a syntax for storing and exchanging data
+Since the JSON format is text only, it can easily be sent to and from a server, and used as a data format by any programming language
+
+## Where JSON is used
+
+The JSON format is often used for serializing and transmitting structured data over a network connection. It is used primarily to transmit data between a server and web application, serving as an alternative to XML.
+
+## How to use JSON
+
+JSON data is normally accessed in Javascript through dot notation
+
+The JSON.stringify() function converts an object to a JSON string.
+JSON.parse() is a secure function to parse JSON strings and convert them to objects.
diff --git a/docs/JavaScript_Advance_Info/array_flat.md b/docs/JavaScript_Advance_Info/array_flat.md
new file mode 100644
index 0000000..c74ed13
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/array_flat.md
@@ -0,0 +1,24 @@
+# Array Flat Method
+
+The `flat()` method creates a new array with nested sub-array elements concatenated into it recursively up to the specified depth. The default depth is one level but the `Infinity` parameter may be used to recursively flatten an array completely until no nested arrays remain.
+
+```js
+var array1 = [1, 2, [3, 4]];
+array1.flat();
+// [1, 2, 3, 4]
+```
+```js
+var array2 = [1, 2, [3, 4, [5, 6, [7, 8]]]];
+array2.flat(2);
+// [1, 2, 3, 4, 5, 6, [7, 8]]
+```
+```js
+var array3 = [1, 2, [3, 4, [5, 6, [7, 8, [9, 10]]]]];
+array3.flat(Infinity);
+// [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
+```
+```js
+var array4 = [1, 2, [3, 4], [5, 6], [7, 8, [9, 10]]];
+array4.flat();
+// [1, 2, 3, 4, 5, 6, 7, 8, [9, 10]]
+```
diff --git a/docs/JavaScript_Advance_Info/arrow_function.md b/docs/JavaScript_Advance_Info/arrow_function.md
new file mode 100644
index 0000000..355c3b9
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/arrow_function.md
@@ -0,0 +1,23 @@
+# Arrow Function
+An arrow function expression is a syntactically compact alternative to a regular function expression.
+
+Example:
+```javascript
+// Regular function
+function greet(name){
+ console.log("Hello " + name);
+}
+
+// Arrow function equivalent
+const greet = name => {
+ console.log("Hello " + name)
+}
+```
+Both functions above are equivalent to each other.
+
+If we have more than one function argument then we should put them in paranthesis like this:
+```javascript
+const exampleFunc = (name,age,eyeColor) => {
+ // ...
+}
+```
diff --git a/docs/JavaScript_Advance/assignments.md b/docs/JavaScript_Advance_Info/assignments.md
similarity index 97%
rename from docs/JavaScript_Advance/assignments.md
rename to docs/JavaScript_Advance_Info/assignments.md
index 84fb0ef..4c208a0 100644
--- a/docs/JavaScript_Advance/assignments.md
+++ b/docs/JavaScript_Advance_Info/assignments.md
@@ -1,4 +1,5 @@
-### Assignments
+# Assignments
+
## Arithmetic
|Operation|Operator|Basic|Shortcut|
|---|---|---|---|
diff --git a/docs/JavaScript_Advance_Info/async_await.md b/docs/JavaScript_Advance_Info/async_await.md
new file mode 100644
index 0000000..5a1511d
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/async_await.md
@@ -0,0 +1,126 @@
+# Async Await
+
+`async` and `await` is **syntactic sugar** for using `promises`. That means that the `async` and `await` keywords are transpiled to normal `promise` syntax.
+
+A simple example of usage of `async` and `await`:
+
+```JavaScript
+// A simple example:
+async function example(){
+ const aVariable = await aFunction();
+ console.log(aVariable)
+}
+
+example();
+```
+
+`async` is written before the function keyword when creating a new function, and enables the usage of the `await` keyword within the function. `await` is only used before function calls that return a promise. We can therefore directly see that `aFucntion` above will be run asynchronously, and return a promise.
+
+Let's say that `aFunction` returns a promise that resolves to the string `hello`. What happens when using the `Async / Await` keyword is:
+
+0. The function `example` is invoked.
+1. The function `aFunction`, which returns a `promise`, is executed asynchronously.
+1. The code waits for the promise returned by `aFunction` to resolve.
+1. When the `promise` is resolved, then `aVariable` is assigned whatever the `promise` is resolved to (`'hello'`).
+1. The `console.log` prints `hello` to the standard output.
+
+Let's remove the `Async / Await`.
+
+```JavaScript
+// A simple example:
+function example(){
+ const aVariable = aFunction();
+ console.log(aVariable)
+}
+
+example();
+```
+
+What happens in this example is:
+
+1. The function `aFunction`, which returns a `promise`, is executed asynchronously.
+2. `aVariable` is assigned the promise.
+3. The `console.log` prints `Promise { : "pending" }`.
+4. The promise resolves to `'hello'`, but that `'hello'` is never handled.
+
+## Extended explanation
+
+```JavaScript
+async function getUsers(){
+ const response = await fetch('https://jsonplaceholder.typicode.com/users')
+ const data = await response.json()
+ console.log('THIS LOGS 10 USER FROM JSON PLACEHOLDER >>', data)
+ return data
+}
+```
+
+or as arrow function
+
+```JavaScript
+const getUsers = async () => {
+ const response = await fetch('https://jsonplaceholder.typicode.com/users')
+ const data = await response.json()
+ console.log('THIS LOGS 10 USER FROM JSON PLACEHOLDER >>', data)
+ return data
+}
+```
+
+The two functions above can be written using the `Promise` syntax. It is then written as follows:
+
+```JavaScript
+function getUsers() {
+ return new Promise(resolve => {
+ fetch('https://jsonplaceholder.typicode.com/users')
+ .then(response => {
+ return response.json()
+ })
+ .then(data => {
+ console.log('THIS LOGS 10 USER FROM JSON PLACEHOLDER >>', data)
+ resolve(data);
+ })
+ })
+}
+```
+
+If you do not return anything from the `async function`, then the promise is simply resolved to `undefined`.
+
+When having `async/await` translated, we can see a two important things.
+
+1. An async function always returns a promise
+2. Async function does not have error handling
+
+```JavaScript
+console.log(getUsers() instanceof Promise) // true
+```
+
+The error is best handled by using a `try/catch` statement inside the async function. **You can then either handle the error in the async function or throw an error and handle it outside the async function.**
+
+```JavaScript
+// Handle error inside of the async function
+async function getUsers () {
+ try {
+ const response = await fetch('https://jsonplaceholder.typicode.com/users')
+ const data = await ressspondse.json()
+ console.log('THIS LOGS 10 USER FROM JSON PLACEHOLDER >>', data)
+ } catch (error) {
+ console.log(error) // ReferenceError: "ressspondse is not defined"
+ }
+}
+
+getUsers()
+
+// Handle error outside the async function
+async function getUsers () {
+ try {
+ const response = await fetch('https://jsonplaceholder.typicode.com/users')
+ const data = await ressspondse.json()
+ console.log('THIS LOGS 10 USER FROM JSON PLACEHOLDER >>', data)
+ } catch (error) {
+ throw error;
+ }
+}
+
+getUsers().catch(error => {
+ console.log(error) // ReferenceError: "ressspondse is not defined"
+})
+```
diff --git a/docs/JavaScript_Advance_Info/bind.md b/docs/JavaScript_Advance_Info/bind.md
new file mode 100644
index 0000000..99fd4eb
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/bind.md
@@ -0,0 +1,22 @@
+# Bind Method
+*The **bind()** method creates a new function that, when called, has its this keyword set to the provided value, with a given sequence of arguments preceding any provided when the new function is called.*
+```js
+ let module = {
+ x: 42,
+ getX: function() {
+ return this.x;
+ }
+ }
+
+ let unboundGetX = module.getX;
+
+ console.log(unboundGetX());
+```
+The above function gets invoked at the global scope
+
+output: undefined
+```js
+ let boundGetX = unboundGetX.bind(module);
+ console.log(boundGetX());
+```
+output: 42
diff --git a/docs/JavaScript_Advance/bitwise-operaors.md b/docs/JavaScript_Advance_Info/bitwise_operaors.md
similarity index 100%
rename from docs/JavaScript_Advance/bitwise-operaors.md
rename to docs/JavaScript_Advance_Info/bitwise_operaors.md
diff --git a/docs/JavaScript_Advance_Info/browser_object_model.md b/docs/JavaScript_Advance_Info/browser_object_model.md
new file mode 100644
index 0000000..7295c99
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/browser_object_model.md
@@ -0,0 +1,19 @@
+# Browser Object Model
+
+## What we can do using BOM Model
+-The Browser Object Model (BOM) is used to interact with the browser.
+-The Browser Object Model (BOM) allows JavaScript to "talk to" the browser.
+-it can be used to manipulate methods and properties associated with the Web browser itself.
+
+## Why to use it
+-BOM provides you with window object, for example, to show the width and height of the window. It also includes the window.screen object to show the width and height of the screen.
+
+## How we can optimize our sites after taking inputs
+-Order in which elements are loaded
+-Minify JavaScript code for smaller file sizes.
+-Optimize it!
+-Asynchronous loading of JavaScript: Defer and Async tags
+-Exclude unused components of .JS libraries.
+-Move some the CSS and JavaScript code of your first screen to the top of your code for faster loading.
+-Where you can, use CSS3 effects in place of JavaScript.
+-Cache it.
diff --git a/docs/JavaScript_Advance_Info/callback.md b/docs/JavaScript_Advance_Info/callback.md
new file mode 100644
index 0000000..af6039e
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/callback.md
@@ -0,0 +1,144 @@
+# Callback Functions
+Callback functions are derived from a programming paradigm called
+`functional programming`. This basically can be concluded to this sentence:
+You can pass (`closure`) functions as an argument to another function.
+
+look at this example:
+
+```javascript
+const sayHi = (afterHi) => {
+ console.log('Hi, ')
+ return afterHi()
+}
+
+sayHi(() => { console.log('How are you?') })
+// [out] 'Hi, '
+// [out] 'How are you?'
+```
+
+
+If you look at the way we called `sayHi`, you will see that, we have not called
+the function which is going to print `'How are you?'`, we have not even named it (Anonymous function)
+This is the prototype of the function. The passed function, will act as if it has been defined
+inside the `sayHi` function. Therefore, you can assume that your function has access to the scope
+of the other function.
+
+example:
+
+```javascript
+ const transformNumber = (num, operator) => {
+ let test = 2;
+ console.log(num)
+ console.log(test)
+ operator(num)
+ console.log(num)
+ console.log(test)
+ }
+
+ transformNumber(10, () => {
+ num = num * num;
+ test = 3
+ })
+ // [out] 10
+ // [out] 2
+ // [out] 100
+ // [out] 3
+```
+
+ One of very common uses of callback functions, is in `Promises`.
+ I suggest you read `promises.js` file, before continuing this section.
+ If you know about javascript `Promise` concept, you should be familiar with
+ `.then()` and `.catch()` functions. These are `Promise`'s prototype methods.
+ When a promise gets resolved (when `.resolve()` gets called), all the arguments
+ passed to the `resolve()` function, will get passed to the function passed to `.then()`
+ function. Look at the following example from MDN official documents:
+
+ ```javascript
+ var p1 = new Promise((resolve, reject) => {
+ resolve('Success!');
+ // or
+ // reject(new Error("Error!"));
+ });
+
+ p1.then(value => {
+ console.log(value); // Success!
+ }, reason => {
+ console.error(reason); // Error!
+ });
+```
+
+So, basically the function that we pass to `.then()` function, is a `callback` function.
+
+We see usage of `Promise` widely in different API call scenarios.
+Different HTTP libraries (`fetch, axios, ...`), use javascript `Promise` object,
+for handling `onSuccess` and `onError` scenarios when calling an API endpoint.
+When you make an API call, if everything goes well and server's response has some
+2xx status code, this API call will be considered as `success` and otherwise, it has `failed`,
+and some `error` messages should be returned.
+
+In the following example, we are going to use `axios` as our HTTP library.
+But you can simulate the exact same scenario using any other HTTP libraries.
+
+
+```javascript
+axios
+ .get('https://cat-fact.herokuapp.com/facts/random')
+ .then(response => {
+ console.log(response, 'success!')
+ })
+ .catch(error => {
+ console.log(error, 'failed!')
+ })
+```
+
+This process of making HTTP requests can get pretty much complicated.
+There are many cases that you need to make several API calls which each
+of them, will rely on the response from some previous requests.
+
+(In this tutorial, we are using the `cat-facts` public API to demonstrate
+ different usages of HTTP libraries. You can read the documentation related
+ to this API, here: https://alexwohlbruck.github.io/cat-facts/docs/)
+
+Let's say we want to retrieve 2 random facts about cats and after retrieving
+the list of 2 facts, start making another API call to retrieve details of each.
+
+According to `cat-facts` docs, we will receive an `_id` field in the list of facts
+and when we make an API call to `/facts/:id` endpoint, we can get details of that specific fact.
+
+Look at the following code snippet:
+
+```javascript
+axios({
+ url: 'https://cat-fact.herokuapp.com/facts/random',
+ method: 'GET',
+ params: {animal_type: 'cat', amount: '2'}
+}).then(response => {
+ console.log('list success!')
+ response.data.forEach((fact, idx) => {
+ axios
+ .get(`https://cat-fact.herokuapp.com/facts/${fact._id}`)
+ .then(factRes => { console.log(`fact #${idx} success: `, factRes) })
+ .catch(factErr => { console.log(`fact #${idx} failed: `, factErr) })
+ })
+}).catch(err => {
+ console.log(err, 'list failed!')
+})
+```
+
+You can see that sometimes, we need to make API calls that rely on
+response of some other API call, therefore we need to make those calls
+in order, and also, if one of these API calls somewhere in this chain fails,
+we do not want to continue making next API calls.
+This specific scenario, can be extended in real lif usage of APIs. You might
+face some situations that you need to chain more than 4-5 API calls. In these
+cases, one will end up writing many nested `.then().catch()` blocks. Also,
+it is not True that we "Always" want to ignore making API calls next in chain,
+if one of requests in chain fails. So, different situations and more exceptions
+to handle and apparently, more nested `.then().catch()` code blocks.
+
+This situations is referred to as `Callbacks Hell`. It really can turn in to a
+mess, if you don't take cautions in writing your clean and readable using callback
+functions. To solve this issue, one might advise to use `async` `await` syntaxes,
+instead of using callback functions. This approach also have pros and cons. One of
+the cons of this approach, is instead of nested `.then()` blocks, you are going to
+need nested `try` `catch` blocks. Sometimes this kind of problems are inevitable.
diff --git a/docs/JavaScript_Advance_Info/classes.md b/docs/JavaScript_Advance_Info/classes.md
new file mode 100644
index 0000000..af73c54
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/classes.md
@@ -0,0 +1,166 @@
+# Classes
+
+JavaScript is a programming language based on **prototypes**.
+Classes represent an improvement to the prototype-based inheritance, and provides a clearer and simpler syntax for creating objects and a new way to deal with inheritance.
+
+> By definition, a class represents a template for the creation of objects, they provides the values for the initial state (variables) and the implementation of the behavior (functions or methods).
+
+## How to define a class
+
+One way to define a class is through a **[class declaration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/class)**, the syntax is as follows:
+
+```javascript
+class Student {
+ builder() {...}
+
+ methodA() {...}
+
+ methodB() {...}
+}
+```
+
+The reserved word `class` is used, followed by the class name (`Student`)
+
+It is also possible to define a class through a **[class expression](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/class)**, which can be **anonymous** or **named**, the syntax is as follows:
+
+```javascript
+// Anonymous
+const Student = class {
+ builder() {...}
+
+ methodA() {...}
+
+ methodB() {...}
+}
+
+// Named
+const Student = class TheStudent {
+ builder() { ... }
+
+ methodA() {...}
+
+ methodB() {...}
+}
+```
+
+> The maiin difference between a **declaration** and an **expression** is that an **expression** creates a local scope; this means that the class name `TheStudent` will only be visible and usable within the class body.
+
+## How to instantiate a class
+
+To instantiate a class, use the reserved keyword [`new`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new), in this way a new object of the class type will be created.
+
+```javascript
+let Bill = new Student();
+```
+
+## Class body
+
+Within the body of the class, there is a special method called [`constructor`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/constructor), this special method is called every time the class is instantiated to create a new object, and serves to define the initial state of the created object, for instance:
+
+```javascript
+class Student {
+ // onlyname; // This should not have let or const only in classes
+ constructor(name, age) { // name and age are arguments given to object at the time of creation of object
+ this.name = name; // This initializes the local variable as name passed in argument
+ this.age = age; // This initializes the local variable as age passed in argument
+ }
+}
+
+const Swapnil = new Student("Swapnil", 19); // This way we can create new objects with arguments
+```
+
+The previous example defines a class of type `Student`, which receives two arguments in the constructor: `name` and `age`, both arguments will define the initial state of the object in two internal variables of the class (called in the same way) `this.name = name` and `this.age = age`.
+
+> The body of the class is all the code that is between the curly braces `{}`.
+
+
+## Class methods
+
+Class methods are defined as functions within the body of the class:
+
+```javascript
+class StudentInfo {
+ // college = "SIES"; // This is allowed above ES7, ES8
+ constructor(name) {// name and age are arguments given to object at the time of creation of object
+ this.name = name; // This initializes the local variable as name passed in argument
+ this.college = "SIES"; // We want the College to be same for all students that's why it is declared outside of constructor
+ }
+
+ getNameAndCollege() {// This is a method in Student
+ console.log(`${this.name} ${this.college}`);
+ }
+}
+```
+
+In the example, a method called `getNameAndCollege` has been defined, to invoke the method it's necessary to instantiate the class to create an object, and then perform the method call, as follows:
+
+```javascript
+const SwapnilInfo = new StudentInfo("Swapnil Bio");
+SwapnilInfo.getNameAndCollege();
+```
+
+## Static methids
+
+It's also possible to define define **[static methods](https://developer.mozilla.org/en-US/docs/Glossary/Static_method)**, [static methods](https://developer.mozilla.org/en-US/docs/Glossary/Static_method) can be called without needing to instantiate the class, for instance:
+
+```javascript
+class StudentInfo {
+ constructor(name) {
+ this.name = name;
+ this.college = "SIES";
+ }
+
+ getNameAndCollege() {
+ console.log(`${this.name} ${this.college}`);
+ }
+
+ static getGreeting() {
+ console.log('Hello world'!);
+ }
+}
+
+StudentInfo.getGreeting();
+// logs on console "Hello world!"
+```
+
+The `getGreeting` method will log `Hello world!` in the console without creating an object with the keyword [`new`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/new).
+
+## Getters and Setters
+
+It's also possible to define two types of special methods: **[getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)** and **[setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)**.
+**[Setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)** help us to assign a value to a class variable, and since it is a function, it is possible to add extra logic in the method as necessary.
+**[Getters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/get)** help us to retrieve the value of a class variable, and same as **[setters](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/set)**, they allow us to define some extra logic inside the method as necessary.
+
+```javascript
+class StudentInfo {
+ constructor() { }
+
+ set name(name) {
+ this.name = name.charAt(0).toUpperCase() + name.slice(1);
+ }
+
+ get name() {
+ console.log (`${this.name}`);
+ }
+
+ set college(college) {
+ this.college = college.toUpperCase();
+ }
+
+ get college() {
+ console.log (`${this.name}`);
+ }
+
+ static getGreeting() {
+ console.log ('Hello world');
+ }
+}
+
+let BillInfo = new StudentInfo();
+
+BillInfo.name = "bill";
+console.log (BillInfo.name); // Logs "Bill" because the extra logic capitalize the first letter
+
+BillInfo.college = "sies";
+console.log (BillInfo.college); // Logs "SIES" because the extra logic capitalizes the whole string
+```
diff --git a/docs/JavaScript_Advance/connectToMongo.md b/docs/JavaScript_Advance_Info/connect_to_mongo.md
similarity index 100%
rename from docs/JavaScript_Advance/connectToMongo.md
rename to docs/JavaScript_Advance_Info/connect_to_mongo.md
diff --git a/docs/JavaScript_Advance_Info/cookies.md b/docs/JavaScript_Advance_Info/cookies.md
new file mode 100644
index 0000000..ce7470b
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/cookies.md
@@ -0,0 +1,34 @@
+# Cookies
+
+## What are cookies?
+Cookies allow a JavaScript program to store data on the user's hard disk.
+
+A "spying" of the user hard disk is just as impossible as the placement of executable code. Because you write a cookie in a JavaScript, you can not specify where the cookie is stored to the user - this controls the browser of the user. In addition, cookies can not write uncontrolled amounts of data to the user's computer, but only a limited number of lines. Each such row defines a variable and assigns a value to that variable (name-value pairs). A cookie can therefore be compared with an entry in a configuration file - with the difference that the cookie can't change configuration data of the user's computer.
+
+## How to use cookies?
+
+### Write a cookie
+Cookies are saved as name-value pairs.
+`movie = Jungle Book`
+
+JavaScript can create, read, and delete cookies with the document.cookie property.
+With JavaScript, a cookie can be created like this:
+`document.cookie = "movie=Jungle Book;"`
+
+You can also specify when the cookie **expires** like this:
+`document.cookie = "movie=Jungle Book; expires=Thu, 18 Dec 2013 12:00:00 UTC"`
+
+You can also specify where the cookie belongs to with **path** like this:
+`document.cookie = "movie=Jungle Book; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/"`
+
+### Read a cookie
+To read a cookie you can use the following code, this will return all cookies saved by the browser:
+`var allCookies = document.cookie` returns e.g. movie=Jungle Book; cookie2=value; cookie3=value
+
+### Delete a cookie
+To delete a cookie you can use the following code, this will delete the cookie by a passed timestamp:
+`document.cookie = "movie=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/"`
+
+> You should define the cookie path to ensure that you delete the right cookie. Some browsers will not let you delete a cookie if you don't specify the path.
+
+[wiki]: https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie
diff --git a/docs/JavaScript_Advance/currying.md b/docs/JavaScript_Advance_Info/currying.md
similarity index 100%
rename from docs/JavaScript_Advance/currying.md
rename to docs/JavaScript_Advance_Info/currying.md
diff --git a/docs/JavaScript_Advance_Info/destructuring.md b/docs/JavaScript_Advance_Info/destructuring.md
new file mode 100644
index 0000000..d6b07ba
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/destructuring.md
@@ -0,0 +1,77 @@
+# Destructuring
+
+## What is destructuring?
+
+Destructuring is a quick and clean way to assign a property on an object to a variable made available as part of ES2015 (ES6). Lets say that we have the following object:
+
+```js
+const a = { // Suppose this is the object coming from server then
+ name: "Swapnil",
+ age: 19,
+ college: "SIES"
+};
+```
+
+If we want to assign the name property of this object to a variable called `name`, we could do this:
+
+```js
+const name = a.name;
+```
+
+This works just fine until we want to assign each property of its object to it's own variable:
+
+```js
+const name = a.name;
+const age = a.age;
+const college = a.college;
+```
+
+This is a bit repetative and now with ES6 destructuring assignment, completely unnecessary. We can now do this:
+
+```js
+const { name, age, college } = a;
+```
+
+This may look a bit weird, but let's walk through it together. You can see that the open bracket directly follows the `const`, followed by the three different properties that we are assigning to variables by the same name. In essence what we are doing is extracting the value of `name`, `age`, and `college` from the `a` object and assigning those values to `const` variables by the exact same name.
+
+## Destructuring and Assignment
+There is a time when you want to destruct an item from an array and immediately name it, with javascript you can do it.
+
+```js
+const { name: surname } = a;
+```
+If you console the name and surname both will display print `Swapnil`.
+
+### Destructuring Array
+Sometime data is saved in an array datastructure, we can destruct them if we want
+```js
+const array = [1, 2, 3, 4]; // Array Declaration
+```
+How to access the items? we have options
+> option 1
+
+When we want to skip specific item
+```js
+const [first, second, , fourth] = array; // Array Destructuring
+```
+Outoput is `1`, `2`, `4` // notice we skipped `third 3`
+> Option 2
+
+When you want all items from array
+```js
+const [first, second, third, fourth] = array; // Array Destructuring
+```
+Outoput is `1`, `2`, `3`, `4` // all are printed
+
+Always check your array length before, and then use the power of destructuring.
+
+## Destructuring and Combination
+We can use our destructuring skills to get a specific item and combine the rest data. How to do it? Basically we need to use javascript `Spread operator`
+
+```js
+const bigArray = [ 1,2,3,4,5,6,6,7,8,9];
+```
+```js
+const [firstItem, ...remainItems] = bigArray
+```
+The output will be first item will be `1` and remaining items will be combained in array `[2, 3, 4, 5, 6, 6, 7, 8, 9]`
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/do_while_loop.md b/docs/JavaScript_Advance_Info/do_while_loop.md
new file mode 100644
index 0000000..69aaae2
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/do_while_loop.md
@@ -0,0 +1,10 @@
+# Do...While Loop
+
+ In a do...while loop, a statement gets executed until the condition is proven false.
+
+
+### Structure:
+
+do {
+ statement
+} while (condition)
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/dom_manipulation_html.md b/docs/JavaScript_Advance_Info/dom_manipulation_html.md
new file mode 100644
index 0000000..927ddd5
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/dom_manipulation_html.md
@@ -0,0 +1,35 @@
+## Top most tree nodes
+
+All operations on the DOM start with the **document** object. That's the main 'entry point' to DOM. From this tree we can access any node. The topmost tree nodes are available directly as document properties:
+- **html**
+- **body**
+- **head**
+
+## DOM navigation
+
+### Children
+- Children are nested exactly in the given one parent. For instance, `` and `` are children of `` element.
+- DOM properties to access nodes are firstChild and lastChild.
+- There’s also a special function `hasChildNodes()` to check whether there are any child nodes.
+- To access only elements i.e excluding comments and text nodes, one should use **firstElementChild** and **lastElementChild** properties.
+
+### Siblings
+- _Siblings_ are nodes that are children of the same parent and resides adjacent to each other.
+- For instance, here `` and `` are siblings.
+- Element only navigation can be achieved by **previousElementSibling** and **nextElementSibling**.
+
+### Parent
+- Top most node of a tree section is known as Parent. For instance html is parent of head and body.
+- The parent is available as **parentNode**.
+- Element counterpart of parent is **parentElement**. But do we really need parentNode then? Answer is yes. For Example taking parent of html
+
+ console.log(document.documentElement.parentNode) //document
+ console.log(document.documentElement.parentElement) //null
+- The reason is that the root node `document.documentElement` (``) has `document` as its parent. But `document`is not an element node, so `parentNode` returns it and `parentElement` does not.
+
+
+## DOM collections
+- **ChildNodes** returns iterable array-like object.
+- We can use for...of loop to iterate over it. Though array methods are not applicable. However `Array.from()` can be used to convert it to a real array.
+- These collections are live and read-only. That means they reflect current state of the DOM and can not be altered or reassigned again.
+- Properties `firstChild` and `lastChild` are shorthand for childNodes[0] and childNodes[element.childNodes.length - 1] but they give fast access to the first and last children.
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/express.md b/docs/JavaScript_Advance_Info/express.md
new file mode 100644
index 0000000..a242feb
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/express.md
@@ -0,0 +1,80 @@
+# Express
+
+## What is Express?
+Express.js is a Node js web application server framework that helps to build single page and hybrid web application.
+It is Fast, unopinionated, minimalist web framework, it means that developers have a right to design or structure the application how they want.
+
+## What can you do with Express?
+You can build the following stacks
+ - MongoDB, Express.js, AngularJS, and Node.js. `MEAN`
+ - MongoDB, Express.js, React, and Node.js. `MERN`
+ - MongoDB, Express.js, Vue, and Node.js. `MEVN`
+
+## How to install Express?
+ > npm install express
+
+## How to configure port?
+```js
+const port = 3003;
+```
+However, If port is taken there will be an issue when we deploy our project to server. it is better we to configure it dynamically.
+
+```js
+const port = process.env.PORT || 3003;
+```
+
+
+## How to import Express?
+```js
+const app = express();
+```
+
+## How to access Route?
+```js
+const routes = express.Router();
+```
+Express has `Router` method that will help us to use `Http method`. for example `get`, `put`, `post` and `patch`.
+
+## get Methods
+Get method is used to request a resource from the server.
+```js
+routes.get("/system_info", (req, res) => {
+ res.send("System on!");
+});
+```
+`"/system_info"` our routes.
+`req` contains information about the http request.
+`res` contains information about the http response.
+`res.send("System on!");` is a message to display on screen after `get` request.
+
+## How to access data?
+If we want to pass json data in our express app we need to configure it. lets say we are expecting `json` data.
+```js
+app.use(express.json());
+```
+## How to configure routes?
+```
+app.use(routes);
+```
+## How to start NodeJS server?
+```js
+app.listen(port, () => console.log(`Server running in port ${port}`));
+```
+
+*Full example*
+```js
+const express = require("express");
+
+const port = 3003;
+const app = express();
+
+const routes = express.Router();
+
+routes.get("/system_info", (req, res) => {
+ res.send("System on!");
+});
+
+app.use(express.json());
+app.use(routes);
+app.listen(port, () => console.log(`Server running in port ${port}`));
+```
diff --git a/docs/JavaScript_Advance/FilteringArray.md b/docs/JavaScript_Advance_Info/filtering_array.md
similarity index 95%
rename from docs/JavaScript_Advance/FilteringArray.md
rename to docs/JavaScript_Advance_Info/filtering_array.md
index 09f0a76..5162442 100644
--- a/docs/JavaScript_Advance/FilteringArray.md
+++ b/docs/JavaScript_Advance_Info/filtering_array.md
@@ -1,4 +1,4 @@
-# FilteringArray
+# Filtering Array
Array prototype has a standard method called filter.
diff --git a/docs/JavaScript_Advance_Info/for_in.md b/docs/JavaScript_Advance_Info/for_in.md
new file mode 100644
index 0000000..484ac45
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/for_in.md
@@ -0,0 +1,27 @@
+# For..In
+The for...in statement iterates over all non-Symbol, enumerable properties of an object.
+
+Examples:
+```javascript
+var result = "";
+var object1 = {a: 'ja', b: 'va', c: 'scri', d: 'pt'};
+
+for (var propIndex in allObject) {
+ result += allObject[propIndex];
+}
+
+console.log(result);
+// expected output: "javascript"
+```
+
+```javascript
+var result = 0;
+var list = [1, 2, 3, 4];
+
+for (var numberIndex in list) {
+ result += list[numberIndex];
+}
+
+console.log(result);
+// expected output: 10
+
diff --git a/docs/JavaScript_Advance_Info/fs_module.md b/docs/JavaScript_Advance_Info/fs_module.md
new file mode 100644
index 0000000..e384430
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/fs_module.md
@@ -0,0 +1,55 @@
+# FS Module
+FS is an inbuilt module in NodeJS used to perform operations on files and directories. There are two ways to do an FS operation: synchronous and asynchronous. The FS library sends event data continuously using NodeJS EventEmitter.
+
+To use FS module, first import it with the following syntax.
+```js
+const fs = require("fs");
+```
+To read from a file, web can use `createReadStream()` method.
+```js
+const content = fs.createReadStream("./resources/file/order.txt");
+```
+If we don't set the encoding type, the data will be printed out in the form of buffer.
+```
+
+```
+Set the encoding to use UTF-8.
+```js
+content.setEncoding("UTF8);
+```
+Because the response object in this case is also a stream, we can listen to events happening on the file.
+For example, here we are listening to the event when our file is successfully opened.
+```js
+content.on("open", () => {
+ console.log("File opened for reading");
+});
+```
+We can also listen to an event called `data` that will be called when data is present.
+```js
+content.on("data", (data) => {
+ console.log(data);
+});
+```
+We can also listen to the event when a file is closed.
+```js
+content.on("close", () => {
+ console.log("File ends");
+});
+```
+
+Working with above example, reading the `./resources/file/order.txt` file will results in the following ouput.
+
+```
+File opened for reading
+arrowFunction
+destructuring
+spread and rest
+timerFunction
+eventloop
+
+promises
+fsModule
+File ends
+```
+
+In conclusion, createReadStream is similar to a publish-subscribe system where our stream is the subscriber and the file is the publisher, and as such can be implemented using MQTT.
diff --git a/docs/JavaScript_Advance_Info/hoisting.md b/docs/JavaScript_Advance_Info/hoisting.md
new file mode 100644
index 0000000..823119b
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/hoisting.md
@@ -0,0 +1,30 @@
+# Hoisting
+
+Basically, when Javascript compiles all of your code, all variable declarations using var are hoisted/lifted to the top of their functional/local scope (if declared inside a function) or to the top of their global scope (if declared outside of a function) regardless of where the actual declaration has been made. This is what we mean by “hoisting”.
+
+
+In JavaScript, a variable can be declared after it has been used. In other words; a variable can be used before it has been declared.
+
+Example 1 gives the same result as Example 2:
+```js
+Example 1 :
+
+x = 5; // Assign 5 to x
+
+elem = document.getElementById("demo"); // Find an element
+elem.innerHTML = x; // Display x in the element
+
+var x; // Declare x
+```
+```js
+Example 2:
+var x; // Declare x
+x = 5; // Assign 5 to x
+
+elem = document.getElementById("demo"); // Find an element
+elem.innerHTML = x;
+```
+
+To understand this, you have to understand the term "hoisting".
+
+Hoisting is JavaScript's default behavior of moving all declarations to the top of the current scope (to the top of the current script or the current function).
diff --git a/docs/JavaScript_Advance_Info/inheritance.md b/docs/JavaScript_Advance_Info/inheritance.md
new file mode 100644
index 0000000..70d63fc
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/inheritance.md
@@ -0,0 +1,155 @@
+# Inheritance
+
+## Prototypal Inheritance
+Inheritance in JavaScript is based on the prototypal model. This means that each object has a private property called its prototype, denoted as `[[Prototype]]` in the ECMAScript standard. Each prototype object has is own prototype until a value of null is reached. This is commonly referred to as the prototype chain. (`null` has no prototype)
+
+This is best demonstrated through example:
+```javascript
+let baseObject = {
+ a: 1,
+ b: 2
+}
+
+// Create a new object with baseObject as the prototype for extendedObject.
+let extendedObject = Object.create(baseObject);
+
+// Define property c to the baseObject.
+// This is not explicitly defined on extendedObject
+// but is accessible via the [[Prototype]].
+baseObject.c = 3;
+
+// It appears that there are no properties on extendedObject
+console.log(extendedObject) // {}
+
+// a and b were defined on the baseObject.
+// The property looks up the prototype chain
+// until the properties of a and b exist or null is encountered for [[Prototype]].
+console.log(extendedObject.a); // 1
+console.log(extendedObject.b); // 2
+
+// Define d on the extendedObject
+// this is not accessible to the baseObject
+// as the [[Prototype]] inherits one way
+extendedObject.d = 4;
+
+// We now see property d on extendedObject
+console.log(extendedObject) // { d: 4 }
+
+// c is accessible because the prototype chain is "alive".
+// As properties are added or deleted, they can be accessed
+// by objects that share a prototype
+console.log(extendedObject.c); // 3
+
+// d is accessible on extendedObject where it was defined
+// but is inaccessible to baseObject and returns undefined
+console.log(extendedObject.d); // 4
+console.log(baseObject.d) // undefined
+```
+
+## Inheritance with Classes
+Classes in JavaScript provide "syntactic sugar" for the prototypal model. Let's again look at this via example:
+
+```javascript
+// Animal class is defined with a property of legs and a method of getLegs
+// which returns the current value of legs.
+class Animal {
+ constructor () {
+ this.legs = 4;
+ }
+
+ getLegs () { // Function for getting legs
+ return (this.legs);
+ }
+}
+
+// Dog inherits the base properties from Animal
+// and adds its own property of age (which is not shared with Animal)
+// and the methods getAge and getSound
+class Dog extends Animal {
+ constructor (age) {
+
+ // We need to call super in order to instantiate the constructor on Animal.
+ // If super is not called, then legs would be inaccessible to the Dog class
+ super();
+ this.age = age;
+ }
+
+ getSound () {
+ return ("Bow");
+ }
+
+ getAge () {
+ return (this.age);
+ }
+}
+
+ // Create a new Dog object passing in 10 for the age parameter
+const tommy = new Dog(10);
+
+// Since the Dog class extends the Animal class
+// tommy has access to the getLegs method
+console.log(tommy.getLegs()); // Output 4
+
+console.log(tommy.getSound()); // Bow
+
+console.log(tommy.getAge()); // 10
+```
+---
+
+Now let's look at the same code but without the syntactic sugar of the `class` keyword:
+
+```javascript
+// This function defines the base "constructor" for us and is
+// comparable to the constructor function found in the class example
+function Animal() {
+ this.legs = 4;
+}
+
+// Adding the getLegs property to the prototype ensures that
+// it will be inherited to any objects that are created from Animal
+Animal.prototype.getLegs = function() {
+ return this.legs;
+}
+
+// The Dog function acts as the constructor, but where is the super call
+// that we use to call the constructor from Animal?
+function Dog(age) {
+ // the call method is similar in function to calling the super method in the
+ // super method in the class based example. In this case, it instantiates the
+ // legs property
+ Animal.call(this);
+
+ this.age = age;
+}
+
+// We set the prototype of Dog to the prototype of Animal
+// in order to have access to the getLegs method that is
+// defined on Animal's prototype
+Dog.prototype = Object.create(Animal.prototype);
+
+// Dog is set as the constructor property on the Dog prototype to
+// match the object structure of the class example
+Dog.prototype.constructor = Dog;
+
+// Define getSound method
+Dog.prototype.getSound = function() {
+ return ("Bow");
+}
+
+// Define getAge method
+Dog.prototype.getAge = function() {
+ return (this.age);
+}
+
+// create new Dog with age 10
+const tommy = new Dog(10);
+
+console.log(tommy); // Dog { legs: 4, age: 10 }
+
+// call getLegs that was inherited from Animal
+console.log(tommy.getLegs()); // 4
+
+// call both getSound and getAge that are defined on Dog
+console.log(tommy.getSound()); // Bow
+console.log(tommy.getAge()); // 10
+```
diff --git a/docs/JavaScript_Advance/jsonParseAndStringify.md b/docs/JavaScript_Advance_Info/json_parse_and_stringify.md
similarity index 94%
rename from docs/JavaScript_Advance/jsonParseAndStringify.md
rename to docs/JavaScript_Advance_Info/json_parse_and_stringify.md
index 790f3fd..ff79d0d 100644
--- a/docs/JavaScript_Advance/jsonParseAndStringify.md
+++ b/docs/JavaScript_Advance_Info/json_parse_and_stringify.md
@@ -1,4 +1,4 @@
-# JSON Parse and Stringify
+## JSON Parse
The `JSON.parse()` method parses a JSON string, which turns the JSON string into an object.
@@ -13,7 +13,7 @@ let catFacts = await fetch(catFactsEndpoint);
let parsedCatFacts = await catFacts.json();
```
-# JSON Stringify
+## JSON Stringify
The `JSON.stringify()` method turns a JavaScript object into a JSON string. `JSON.Stringify` takes 3 arguments:
diff --git a/docs/JavaScript_Advance_Info/keys.md b/docs/JavaScript_Advance_Info/keys.md
new file mode 100644
index 0000000..cf45b2f
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/keys.md
@@ -0,0 +1,20 @@
+# Object.keys()
+
+Object.keys() is a method on the Object class in javascript. It is useful for listing the enumerable parameter names of an object.
+
+## Using Object.keys()
+
+Object.keys() accepts a javascript object as a single parameter and returns an array of the parameter names. For example
+
+```js
+var exampleObject = {
+ a: "apple",
+ b: "boat",
+ c: "car"
+};
+
+console.log(Object.keys(exampleObject));
+// expected output: ["a", "b", "c"]
+```
+
+***An Exhaustive reference for Object.keys() and other object methods can be found at [MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys)***
diff --git a/docs/JavaScript_Advance/mapObject.md b/docs/JavaScript_Advance_Info/map_object.md
similarity index 66%
rename from docs/JavaScript_Advance/mapObject.md
rename to docs/JavaScript_Advance_Info/map_object.md
index 70203a8..aad9dbf 100644
--- a/docs/JavaScript_Advance/mapObject.md
+++ b/docs/JavaScript_Advance_Info/map_object.md
@@ -1,6 +1,5 @@
+# Map Objects
-
-**Map : Object**
*Maps allow associating keys and values similar to normal Objects except Maps allow any Object to be used as a key instead of just Strings and Symbols. Maps use get() and set() methods to access the values stored in the Map.
A Map are often called a HashTable or a Dictionary in other languages.*
@@ -65,3 +64,54 @@ iterate over [key, value] entries
alert(entry); // cucumber,500 (and so on)
}
```
+
+Loop with forEach
+Instead of using for loop, forEach can be used.
+
+```js
+map.forEach(function(value, key){
+
+});
+```
+or with array function
+```js
+map.forEach((value, key) => {
+
+})
+```
+
+```js
+recipeMap.forEach((value, key) => {
+ alter(key + " = " + value);
+});
+```
+Convert To Arrays
+A map obejct can be convert to arrays
+
+```js
+var array = Array.from(map) // create an array of the key-value pairs
+
+var array = Array.from(map.value()) // Create an array of the values
+
+var array = Array.from(map.key()) // Create an array of the keys
+
+```
+
+Create an array of the key-value pairs
+```js
+const keyValArr = Array.from(recipeMap);
+alter(keyValArr);
+```
+
+Create an array of the values
+```js
+const ValArr = Array.from(recipeMap);
+alter(ValArr);
+```
+
+Create an array of the keys
+```js
+const keyArr = Array.from(recipeMap);
+alter(keyArr);
+```
+
diff --git a/docs/JavaScript_Advance_Info/object_assign.md b/docs/JavaScript_Advance_Info/object_assign.md
new file mode 100644
index 0000000..0c41258
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/object_assign.md
@@ -0,0 +1,38 @@
+# Object.assign()
+
+Object.assign() is a method on the Object class in javascript. It is useful for creating copies of objects as well as merging objects.
+
+## Using Object.assign()
+
+Object.assign() accepts two paramaters as follows: ```Object.assign(targetObject, ...sources)```
+
+Object.assign() can be particularly useful for dealing with the fact that assigning a javascript object
+to another javascript object is really passing along a reference to the first object.
+This can result in confusion and surprise when you pass some data along to a method that mutates it, and then try to
+operate on the original object with the expectation that it has stayed the same. Object.assign() allows you to avoid this
+confusion by creating a brand new object for you to pass along so your original data is safe from these "side effects".
+An example of this is as follows:
+
+```js
+var object1 = {
+ key: "value"
+};
+
+var object2 = object1;
+
+object2.key = "newValue";
+
+console.log(object1);
+// expected output: { key: "newValue" }
+console.log(object2);
+// expected output: { key: "newValue" }
+
+object2 = Object.assign({}, object1);
+
+object2.thing2 = "reallyNewValue";
+
+console.log(object1);
+// expected output: { key: "newValue" }
+console.log(object2);
+// expected output: { key: "reallyNewValue" }
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/polymorphism.md b/docs/JavaScript_Advance_Info/polymorphism.md
new file mode 100644
index 0000000..f73a80b
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/polymorphism.md
@@ -0,0 +1,63 @@
+# Polymorphism
+Polymorphism is one of the basic principles of **object-oriented programming (OOP)**. It is the practice of designing objects to share behavior and be able to overwrite common behaviors associated with specific ones. Polymorphism uses inheritance to realize this.
+
+*Related: [Inheritance](JavaScript_Basics/inheritance.md), [Classes](JavaScript_Basics/classes.md)*
+
+## Parent class
+Let's create a `class` called Person first.
+```javascript
+class Person {
+ constructor(name) {
+ this.name = name;
+ }
+
+ getName() {
+ return this.name
+ }
+
+ getPosition() {
+ return "Unemployed";
+ }
+}
+```
+
+## Child class
+We like to extend this `class` for Employees. This can be done by creating a `class` and adding `extends`.
+```javascript
+class Employee extends Person {
+ constructor(name, position, salary) {
+ super(name); // super() calls the constructor of Person
+
+ this.position = position;
+ this.salary = salary;
+ }
+
+ getPosition() { //overwrites the method of person
+ return this.position
+ }
+
+ getSalary() {
+ return this.salary
+ }
+}
+```
+
+## Output
+As you can see in the output below, `getPosition()` gets overwritten in `Employee` and `getName()` can be used from `Person` in `Employee`
+```javascript
+let person = new Person("James");
+let employee = new Employee("Torsten", "Developer", 45000);
+
+console.log(employee.getName()); // Output: Torsten
+console.log(person.getName()); // Output: James
+
+console.log(employee.getPosition()); // Output: Developer
+console.log(person.getPosition()); // Output: Unemployed
+```
+
+The above example describes the polymorphism in ECMAScript.
+An object "Person" can be described in many forms (e.g. Employee, ...).
+
+Another example from reality about polymorphism:
+
+When I mention an Asian person, it is very abstract. It can be Japanese, Vietnamese or Indian. But they all share the typical characteristics of Asians.
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/popup_boxes.md b/docs/JavaScript_Advance_Info/popup_boxes.md
new file mode 100644
index 0000000..5bc0d8c
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/popup_boxes.md
@@ -0,0 +1,56 @@
+# Popup boxes
+
+## Alert
+
+**Description:** alert is popup displays message and blocks any user operation till the popup will be closed.
+
+**Param:** {string} condition message to display in popup
+
+**Returned value:**
+
+```javascript
+undefined;
+```
+
+**Example:**
+
+```javascript
+const callAlertMessage = message => alert(message); // display alert with passed message
+
+console.log(callAlertMessage('message in alert popup')); // undefined
+```
+
+## Confirm
+
+**Description:** confirm is popup displays message with accept/reject options and block any user operation till the popup will be closed. Once the confirm message will resolved/rejected the appropriate result will be returned.
+
+**Param:** {string} condition - message to display in popup
+
+**Returned value:** {boolean} confirm/reject from user on passed condition
+
+**Example:**
+
+```javascript
+const isUserConfirmCondition = condition => confirm(condition);
+console.log(isUserConfirmCondition('Do you agree?')); // true if user will press OK button else false
+
+const sendNotificationIfUserAgreed = (notificationMessage, doOnApply, doOnReject) =>
+ isUserConfirmCondition(notificationMessage) ? doOnApply() : doOnReject();
+```
+
+## Prompt
+
+**Description:** prompt is popup displays message with input field and block any user operation. Once the user enter the input value the appropriate result will be returned. null will be returned if user will press cancel or close the popup.
+
+**Param:** {string} message - message to display in popup
+
+**Returned value:** {string | null} - entered by user value or null on cancel
+
+**Example:**
+
+```javascript
+const getUserEnterredValue = message => prompt(message);
+const getUserPrimaryLanguage = message => getUserEnterredValue(message);
+
+console.log(getUserEnterredValue('which language is primary for you?')); // return sring with answer or null
+```
diff --git a/docs/JavaScript_Advance/postgresConnection.md b/docs/JavaScript_Advance_Info/postgres_connection.md
similarity index 98%
rename from docs/JavaScript_Advance/postgresConnection.md
rename to docs/JavaScript_Advance_Info/postgres_connection.md
index 2adfac7..ee4dfb9 100644
--- a/docs/JavaScript_Advance/postgresConnection.md
+++ b/docs/JavaScript_Advance_Info/postgres_connection.md
@@ -1,7 +1,7 @@
# PostgreSQL
PostgreSQL is an open source object-relational database system with over 30 years of active development.
-# Configuration
+## Configuration
To connect with your database you need to modify `configuration` object and fill specific fields with your database connection data.
There are two basic ways to connect to your database:
@@ -34,7 +34,7 @@ Mine configuration object looks like:
**REMEMBER!** As you can see, above connection URI contains connection password: `NWDMCE...`. DO NOT commit any connection information (host, user, password, database, connection URI) to public repositories on GitHub, etc.!
In this case we can do that because above connection information are publicly available and user has read-only access.
-# CODE'n'RUN
+## CODE'n'RUN
In this example we will use async/await approach.
For first we need to create Client object:
@@ -62,7 +62,7 @@ await client.end();
It is short sample with basic query to database. Now you can run our script in terminal: `node postgresConnection.js`
Look at the next section for more information about postgres node client and sql.
-# Helpful links
+## Helpful links
* [Postgres](https://www.postgresql.org/)
* [Node Postgres](https://node-postgres.com/)
* [SQL Tutorial](https://www.w3schools.com/sql/)
diff --git a/JavaScript_Advance/promises.js b/docs/JavaScript_Advance_Info/promises.md
similarity index 66%
rename from JavaScript_Advance/promises.js
rename to docs/JavaScript_Advance_Info/promises.md
index 6467781..f6b2ea7 100644
--- a/JavaScript_Advance/promises.js
+++ b/docs/JavaScript_Advance_Info/promises.md
@@ -1,12 +1,16 @@
-// Promises provide a more convenient syntax to handle asynchronous operations without wanting to tear your hair out.
-// Consider this example, pre promises:
+# Promises
+
+Promises provide a more convenient syntax to handle asynchronous operations without wanting to tear your hair out.
+
+Consider this example, pre promises:
+```javascript
+// Assume we have a number of async operations that need to run in sequence - we need the result to grab the next result.
const getAsyncDataWithCallbacks = (string, cb) => {
setTimeout(() => {
cb(`${string} bar`);
}, 1000);
};
-// Assume we have a number of async operations that need to run in sequence - we need the result to grab the next result.
getAsyncDataWithCallbacks('foo', firstResult => {
getAsyncDataWithCallbacks(firstResult, secondResult => {
getAsyncDataWithCallbacks(secondResult, thirdResult => {
@@ -14,8 +18,14 @@ getAsyncDataWithCallbacks('foo', firstResult => {
})
});
});
+```
+
+Notice the nested layers of callbacks - callbacks inside of callbacks. This is commonly referred to as "callback hell" -
+where we have too many callbacks to the point of making our code unmanageable.
+
+This is eased via the use of promises. You can change these async calls to return a promise instead that wraps that value like so:
-//This is eased via the use of promises. You can change these async calls to return a promise instead that wraps that value like so:
+```javascript
const getAsyncDataWithPromises = string => {
return new Promise((resolve, reject) => {
//Assume an async operation here. We'll set a timeout to give an example.
@@ -23,26 +33,37 @@ const getAsyncDataWithPromises = string => {
setTimeout(() => resolve(`${string} bar`), 1000);
});
};
+```
+Our callback chaining above instead now becomes:
+
+```javascript
getAsyncDataWithPromises('foo')
.then(firstSet => getAsyncDataWithPromises(firstSet))
.then(secondSet => getAsyncDataWithPromises(secondSet));
-//... etc. etc. etc.
+ //... etc. etc. etc.
// Or, a more simplified version using references
getAsyncDataWithPromises('foo')
.then(getAsyncDataWithPromises)
.then(getAsyncDataWithPromises);
+```
+
+As shown above, using promises allows us to create "chains" of asynchronous operations that can be run one after another.
+`then` will not be called until a promise's value is resolved. `catch` will only be called if something goes wrong.
-// As shown above, using promises allows us to create "chains" of asynchronous operations that can be run one after another.
-// `then` will not be called until a promise's value is resolved. `catch` will only be called if something goes wrong.
-getAsyncDataWithPromises()
+````javascript
+getAsyncData()
.then(data => {
//... use data
}).catch(e => {
- //... handle exception
-});
+ //... handle exception
+ });
+````
+
+Some further examples:
+```javascript
// promises promise the nodejs main thread that i'm going to come after doing a particular task
const a = new Promise((resolve, reject) => { // This is a empty promise
@@ -77,4 +98,5 @@ asyncCall
// appended with ' bar' to become 'foo bar'
.then(val => `${val} bar`)
// console logs 'foo bar'
- .then(console.log);
\ No newline at end of file
+ .then(console.log);
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Advance_Info/prototype.md b/docs/JavaScript_Advance_Info/prototype.md
new file mode 100644
index 0000000..9a1e6df
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/prototype.md
@@ -0,0 +1,98 @@
+# Prototype
+
+[Prototype-based programming](https://en.wikipedia.org/wiki/Prototype-based_programming) and prototypal inheritance are very important concepts to learn in JavaScript programming language. It is very similar to object-oriented programming model where you can inherit the functions and properties of the parent class. JavaScript did not have class-based inheritance until the introduction of ES6 ([6th Edition - ECMAScript 2015](https://en.wikipedia.org/wiki/ECMAScript#6th_Edition_-_ECMAScript_2015)). Objects in javascript are mutable, so it allows its properties to be modified or reassigned. An important idea about the prototype is the prototype chain. An object or a function initially points to its default prototype.
+
+Let's look at a basic example. When you create an object `car` using the `{}` notation. In the diagram below, when we created an object, it has by default inherited the methods (behaviors or functions) and properties of the Prototype Object. The magic is happening through `__proto__` property which appeared in the object. We did not add it while creating. It was attached by the prototypal feature of the language.
+
+
+
+Let's see if we can invoke or call those functions against our object which is the `car`.
+
+```javascript
+// lets create the car object
+let car = {
+ make: 'Audi',
+ model: 'A8',
+ wheels: 4
+}
+
+console.log(car.toString())
+// [out] "[object Object]"
+
+console.log(car.valueOf())
+// [out] {make: "Audi", model: "A8", wheels: 4}
+
+```
+
+As you can see in the code snippet above, we have not created those functions but they were inherited by the car object from `Object`. What we understand from this is that any object or function can look for values or methods which are defined in `__proto__`
+
+Let us take another example. This time we will create a constructor function `Person` and attach additional methods to the prototype to add additional features.
+
+```javascript
+// Prototypes are an extension for objects in javascript
+// we use to encapsulate certain functionality to an Object (like a Class)
+
+// first create an Object Person
+// that receive the name and lastName
+
+function Person (firstName, lastName) {
+ this.firstName = firstName;
+ this.lastName = lastName;
+}
+
+// We user the prototype keyword to add some functionality to this Person Object
+
+// add a method getName that return the name
+Person.prototype.getName = function () {
+ return this.firstName;
+};
+
+// add a method getLastName that return the lastName
+Person.prototype.getLastName = function () {
+ return this.lastName;
+};
+
+// add a method getFullName that return the name + lastName
+Person.prototype.getFullName = function () {
+ return this.firstName + " " + this.lastName;
+};
+
+// add a method getFormalName
+Person.prototype.getFormalName = function () {
+ return this.lastName + ", " + this.firstName;
+};
+
+// these methods appear in the __proto__ property
+// of an Object instance of Person
+
+const max = new Person("Max", "Payne");
+
+console.log(max.getName());
+// [out] Max
+
+console.log(max.getLastName());
+// [out] Payne
+
+console.log(max.getFullName());
+// [out] Max Payne
+
+console.log(max.getFormalName());
+// [out] Payne, Max
+```
+
+Now you may be a little confused with the above example. We are introducing another piece to the puzzle, `prototype` property. In the above example, the function `Person` (also known as constructor function as it returns an object) gets to be the prototype of the object `max`. When you add additional functions to the prototype, they apply to the object `max` as well.
+
+
+
+The diagram above shows that `max` has a `__proto__` which is pointing to the `prototype` of `Person`. Let's see if it matches.
+
+
+
+Looks similar, let us compare. Enter following code in the console (only after you have already executed the Person and max related code snippet above)
+
+```javascript
+max.__proto__ === Person.prototype
+// [out] true
+```
+
+And guess what? the chain does not end there, `Person.prototype` has a property `__proto__` which now points to `Object`.
diff --git a/docs/JavaScript_Advance_Info/redis.md b/docs/JavaScript_Advance_Info/redis.md
new file mode 100644
index 0000000..d7559b2
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/redis.md
@@ -0,0 +1,40 @@
+# Redis
+Redis is an open source (BSD licensed), in-memory data structure store, used as a database, cache and message broker.
+It supports data structures such as strings, hashes, lists, sets, sorted sets with range queries, bitmaps, hyperloglogs, geospatial indexes with radius queries and streams.
+
+## How to connect with Redis
+The first thing that we need to do is install Redis
+We can either download the latest Redis tarball from redis.io, or we can use a special URL that always points to the latest stable Redis version: http://download.redis.io/redis-stable.tar.gz.
+
+To compile Redis follow these simple steps:
+```shell
+ -mkdir redis && cd redis
+ -curl -O http://download.redis.io/redis-stable.tar.gz
+ -tar xvzf redis-stable.tar.gz
+ -cd redis-stable
+ -make
+```
+Once the compilation is done, the src directory within redis-stable is populated with different executables that are part of Redis
+```
+ -redis-server: runs the Redis Server itself.
+ -redis-sentinel: runs Redis Sentinel, a tool for monitoring and failover.
+ -redis-cli: runs a command line interface utility to interact with Redis.
+ -redis-benchmark: checks Redis performance.
+ -redis-check-aof and redis-check-dump: used for the rare cases when there are corrupted data files.
+```
+Starting Redis
+The easiest way to start the Redis server is by running the redis-server command. In a fresh shell window, type:
+```
+ -redis-server
+```
+How to Check if Redis is Working
+```
+ -redis-cli ping
+```
+## Where can we get the free Redis instant
+Redis Cloud
+ -https://elements.heroku.com/addons/rediscloud
+ -https://appharbor.com/addons/rediscloud
+
+Redis Labs
+ -https://redislabs.com/
diff --git a/docs/JavaScript_Advance_Info/regex.md b/docs/JavaScript_Advance_Info/regex.md
new file mode 100644
index 0000000..1519591
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/regex.md
@@ -0,0 +1,77 @@
+# Regex
+
+Regex stands for "regular expression", and is a pattern used to search for character combinations in strings. Regular expressions may look confusing at first, but they are a powerful tool for working with strings.
+
+## Constructing a Regex
+
+Regex can be constructed in the following ways:
+
+```js
+var re = /pattern/flags;
+(which will be used throughout the examples)
+
+and
+
+var re = new RegExp('pattern', 'flags');
+```
+
+In each of these cases, the variable `re` is a regex, and 'pattern' and 'flags' are placeholders that we will learn about next.
+
+## Simple Character Patterns
+A Regex can be constructed from simple characters, like 'a', 'b', and 'c', or special characters such as '()', '*', and '$'. A Regex using simple characters simply searches for an exact match of that combination of characters within the searched string. The most basic example of a regex would be:
+
+```js
+var re = /abc/;
+```
+
+This Regex searches a string for occurences of 'abc'. When executed using one of the possible regex methods, String.search(), the following would occur:
+
+```js
+var re = /abc/;
+var exampleString = 'abcdefg';
+var result = exampleString.search(re);
+console.log(result);
+// expected output: 0 since 'abc' is found at index 0 of exampleString
+```
+
+## Special Character Patterns
+Once you are ready to perform more complex searches on strings, you will want to start using special characters. There are a lot of special characters that can be used, so only a select few will be covered below, and a reference with explanations for the exhausive list of characters can be found at the bottom of the document.
+
+- `/[abc]/` specifies a character set which matches any one of the characters within the brackets. Unlike `/abc/`, `/[abc]/` matches on indices 0, 1, and 2 of the example string used in the Simple Character Patterns example. An alternative syntax for `/[abc]/` is `/[a-c]/`.
+- `/[^abc]/` on the other hand, specifies the opposite character set of the characters within the brackets. Referencing the Simple Character Patterns example again, this regex would match on indices 3, 4, 5, and 6 since those do not contain the characters 'a', 'b', or 'c'.
+- `/.cd/` uses the '.' special character which matches any character that is not a newline character. In the Simple Character Patterns example, this regex would match on the index 1 since 'bcd' satisfies the given regex ('b' is a character that is not a newline) and starts at index 1. However, if the exampleString was instead 'cdefg', the regex would not match on any indices and return -1.
+- `/s+/` uses the '+' special character which acts as a placeholder for one or more of the preceding character. In this case, the preceding character is 's'. This means that this regular expression will match on the first instance where there is one or more 's' characters in the test string. Instead of using the `String.search()` method like before, a better example would use `String.match()` like below:
+```js
+var re = /s+/;
+var exampleString = "tallahassee";
+var result = exampleString.match(re);
+console.log(result);
+// expected output: ["ss", index: 7, input: "tallahassee", groups: undefined]
+// where "ss" is the segment of the example string that the regex matched on
+
+var exampleString2 = "tortoise";
+var result2 = exampleString2.match(re);
+console.log(result2);
+// expected output: ["s", index: 6, input: "tortoise", groups: undefined]
+```
+- `/wo*/` uses the '\*' special character which matches the preceding expression zero or more times. This essentially means that the regex will match the first instance of a 'w', or a 'wo' in the searched string. The '\*' special character makes the preceding character optional when finding matches in a string.
+- `/^abc/` uses the '^' special character outside of the context of square brackets. In this case, the '^' special character refers to the beginning of the search string. A search using this regex would succeed for the test string 'abcdefg' since the simple character pattern 'abc' does occur at the beginning of the test string.
+- `/efg$/` uses the '$' special character, which refers to the end of the search string. A search using this regex would also succeed for the test string 'abcdefg' since this test string ends in the simple character pattern 'efg'.
+
+## Flags
+Flags are placed at the end of Regex, and allow for an even more robust set of search possibilities. They can be used together or independently regardless of order. Two of the most commonly used flags are:
+
+- `g`: Global search. This allows the regex to be applied to the entire test string, regardless of whether a match has already been found.
+- `i`: Case insensitive. This allows the regex to be applied just as it sounds, matching on characters regardless of case.
+
+## Methods For Using Regex
+Once you have constructed your regex to theoretically accomplish whatever pattern matching and string searching you set out to accomplish, you will still want to actually exectute your regex on strings. The methods for using regex allow you to do exactly that. There are multiple methods for performing regex searches built into both the RegExp class that you saw above, as well as the String class. Jumping right into the basic regex methods:
+
+- `String.search(regExp)`: accepts a regex as a parameter and tests for a match in the string. The return value is the index of the match if successful, and -1 if no matches were found.
+- `String.match(regExp)`: also accepts a regex as a parameter. The return value for match is an array containing all of the matches found in the string for the given regex and any capturing groups. If no matches are found, the return value is null.
+- `RegExp.test(testString)`: accepts a test string and returns true if the regex finds any matches in the test string. Otherwise the method returns false.
+- `RegExp.exec(testString)`: also accepts a test string as a parameter. This method returns an array containing useful information about the match such as the matched string and the indices that it stars and ends at within the test string.
+
+
+
+***An Exhaustive reference of patterns, flags, and methods can be found at the [MDN page on Regular Expressions](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions)***
diff --git a/JavaScript_Advance/set-function.md b/docs/JavaScript_Advance_Info/set_function.md
similarity index 95%
rename from JavaScript_Advance/set-function.md
rename to docs/JavaScript_Advance_Info/set_function.md
index 0e5cb1e..f7eabad 100644
--- a/JavaScript_Advance/set-function.md
+++ b/docs/JavaScript_Advance_Info/set_function.md
@@ -1,3 +1,5 @@
+# Set Function
+
In JavaScript, a setter can be used to execute a function whenever a specified property is attempted to be changed.
Setters are most often used in conjunction with getters to create a type of pseudo-property.
diff --git a/docs/JavaScript_Advance/set-object.md b/docs/JavaScript_Advance_Info/set_object.md
similarity index 89%
rename from docs/JavaScript_Advance/set-object.md
rename to docs/JavaScript_Advance_Info/set_object.md
index 226c311..fb64b58 100644
--- a/docs/JavaScript_Advance/set-object.md
+++ b/docs/JavaScript_Advance_Info/set_object.md
@@ -1,54 +1,50 @@
-# Set object
+# Set Object
The ***Set*** object stores a collection of values of any type, where each value can only occur once. Sets let you mix in different types of primitives and objects in the same
set, making a strickly equality test comparision when it's created and deleting duplicated elements. Set can also be iterated using **for..of** loops or **forEach()** method,
which iterate the values in insertion order.
## Creating Sets
-
The Set object can be created using the keyword ***new***:
```javascript
new Set([iterable]);
```
### Parameters
-`iterable`
+`iterable`
An iterable object. All the elements will be copied to the new created Set. If this parameter is not specify or it's value is null, the new Set is empty.
### Return value
A new Set object.
-
## Instance Methods
-
-`set.add(value)`
+`set.add(value)`
*Adds* a new element to the Set with the given *value*. If the element is already contained in the Set, the element will be not added.
-`set.delete(value)`
+`set.delete(value)`
Delete the value in the Set. If the value exist return *true*, otherwise *false*.
-`set.has(value)`
+`set.has(value)`
Return *true* if the value exists in the Set, else return *false*.
-`set.clear()`
+`set.clear()`
Delete all the elements in the Set. Return an *empty* set.
### Iteration Methods
-`set.forEach(callback(value, key, set))`
+`set.forEach(callback(value, key, set))`
Call ***callback*** for each element in the Set. ***Value*** and ***key*** parameters represents the current element being processes. The duplication of values is to mantain
compatibility with Map objects. The ***set*** argument represent the Set object which forEach() was called upon.
-`set.entries()`
+`set.entries()`
Return and interator with and array of **[value, value]** for each element, similar to Map object but with the same value for *value* and *key*.
-`set.values()`
+`set.values()`
Return an interator that contains the values for each element in the Set object in insertion order.
-`set.keys()`
+`set.keys()`
The same as ***set.values()***.
-
## Examples
Examples can be consulted in the corresponding "***set-objects.js***" file.
diff --git a/docs/JavaScript_Advance_Info/spread_&_rest.md b/docs/JavaScript_Advance_Info/spread_&_rest.md
new file mode 100644
index 0000000..7271f40
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/spread_&_rest.md
@@ -0,0 +1,66 @@
+# Spread & Rest
+JavaScript version ES6 introduced two new pieces of functionality which utilize the three-dot notation ("..."): the spread operator and the rest parameter.
+
+## Spread
+The spread operator can be used to expand arrays and objects into multiple elements. The following example combines two arrays into one using the spread operator on the original two arrays. Spreading them out into the new array creates that array using all of the elements of the original two arrays.
+```javascript
+const array1 = [1, 2, 3, 4, 5, 6];
+
+const array2 = [6, 7, 8, 9, 10];
+
+const combinedArray = [...array1, ...array2];
+
+console.log(combinedArray);
+/* Output
+[
+ 1, 2, 3,
+ 4, 5, 6,
+ 6, 7, 8,
+ 9, 10
+] */
+```
+The spread operator can also be used on objects. In the following example, two objects are combined into one new object.
+```javascript
+const obj1 = {
+ name: "Swapnil",
+ branch: "Comps"
+};
+
+const obj2 = {
+ age: 19,
+ college: "SIES"
+};
+
+const finalObj = { ...obj1, ...obj2 };
+
+console.log(finalObj);
+/* Output
+{ name: 'Swapnil', branch: 'Comps', age: 19, college: 'SIES' }
+*/
+```
+
+## Rest
+The rest parameter is essentially the opposite of the spread operator. While spread allows you to expand a collection into its individual elements, rest allows you to combine elements back into a collection. In the following example, the remaining (or "rest") of the elements in the original array are combined into a new array called *remaining* because they represent the rest of the elements in the *marks* array.
+```javascript
+const marks = [1, 2, 3, 4, 5, 6, 7, 8, 9]; // Array Declaration
+
+const [first, second, third, ...remaining] = marks;
+
+console.log(first, second, third); // Output 1 2 3
+
+console.log(remaining); // Output [ 4, 5, 6, 7, 8, 9 ]
+```
+
+The rest parameter can also be used with objects. In this example, the rest of the elements within the *a* object (aside from the *name* and *age* object properties) are included in the new *unwanted* object.
+```javascript
+const a = {
+ name: "Swapnil",
+ branch: "Comps",
+ age: 19,
+ college: "SIES"
+};
+
+const { name, age, ...unwanted } = a; // Here in unwanted all key and values expect the name and age will come this is different than arrays
+
+console.log(unwanted); // Output { branch: 'Comps', college: 'SIES' }
+```
diff --git a/docs/JavaScript_Advance_Info/this.md b/docs/JavaScript_Advance_Info/this.md
new file mode 100644
index 0000000..ad2750f
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/this.md
@@ -0,0 +1,101 @@
+# This
+
+JavaScript's 'this' keyword refers to the object it belongs to. It's values depends on where it is used.
+
+
+## This as global variable
+If `this` is used alone, it refers to a global object. In browsers it refers to Window Object as Global Object.
+
+```javascript
+var k = this;
+console..log(k)
+
+/* Output
+
+Window {postMessage: ƒ, blur: ƒ, focus: ƒ, close: ƒ, parent: Window, …}
+
+ */
+
+```
+
+## 'this' in a function
+
+In JavaScript, by default the owner of the function is `this`. The value of this in a function refers to the object it belongs to. In below example, `this` refers to window object, so instead of printing '5' it refers to global value '10'.
+
+```javascript
+var x =10;
+function printX() {
+ var x = 5;
+ console.log(this.x)
+}
+
+printX(); /* its like this.printX() or window.printX() */
+
+
+/* Output
+10 /* this refers to global object so prints 10 */
+*/
+```
+
+## This in function - strict mode
+
+if `use strict` mode is enabled, `this` don't refer to the global object by default. It gives `undefined` when a function is called without explicitly using `this`
+
+```javascript
+// setInterval This runs a code after specific interval of time till we stop the timer.
+`use strict'
+var x =10;
+function printX() {
+ var x = 5;
+ console.log(this.x)
+}
+this.printX();
+printX();
+
+/* Output
+10 // printX() called with this
+ Uncaught TypeError: Cannot read property 'x' of undefined // printX() called without this
+ */
+```
+
+## 'this' in a method
+
+In JavaScript, `this` in a method refers to the object of which the method belongs to. In below example, the `printX` method belongs to person object. so `this` refers to person object.
+
+```javascript
+var firstName = "John";
+var person = {
+ firstName: "Jenny",
+ printX : function() {
+ console.log(this.firstName)
+ }
+}
+person.printX();
+
+/* Output
+ Jenny
+*/
+```
+
+## Explicit function binding
+Calling `object A` method, using values of `object B` is called Explicit function binding. JavaScript provides two method `call()` and `apply()`
+
+For more details read on [call()](/JavaScript_Basics/call) and [apply()](/JavaScript_Basics/apply) .
+
+
+```javascript
+var personA = {
+ firstName: "Jenny",
+ printX : function() {
+ console.log(this.firstName)
+ }
+}
+var personB = {
+ firstName: "John"
+}
+personA.printX.call(personB);
+
+/* Output
+ John
+*/
+```
diff --git a/docs/JavaScript_Advance_Info/timer_function.md b/docs/JavaScript_Advance_Info/timer_function.md
new file mode 100644
index 0000000..6d452f7
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/timer_function.md
@@ -0,0 +1,115 @@
+# Timer Function
+
+Timer function allows us to execute a code at specified time intervals.
+
+There are two imporant methods :
+1. setInterval(function, milliseconds)
+2. setTimeout(function, milliseconds)
+
+We can run our code multiple times at particular time intervals. Let say we want to check the status of our website. We need to ping our website url after every minute. We can use setInterval method for this.
+
+If we want to delay the execution of our code then setTimeOut method can be used. For example, we want to popup a message box to user after 30 seconds of the page load.
+
+ The `setTimeout()` and `setInterval()` are methods of the Window object.
+
+## setTimeout(function, milliseconds)
+
+ The `setTimeout()` method runs a code after given time starting from calling this method in program..
+
+ The setTimeout function accepts two parameters:
+
+ - *function * : a function to be executed
+ - *milliseconds *: the number of milliseconds to wait before execution
+
+```javascript
+
+setTimeout(() => {
+
+ console.log("Heloooo 7 !!!");
+
+}, 7000); /* This will print Hellooo !!! after 7 seconds */
+
+
+setTimeout(() => {
+
+ console.log("Heloooo 3 !!!");
+
+}, 3000); /* This will print Hellooo !!! after 3 seconds */
+
+/* Output
+
+Heloooo 3!!!
+Heloooo 7!!!
+
+ */
+
+```
+
+## Stopping the timer or Cancelling the setTimeout method
+
+We can stop execution of `setTimeout()` using `clearTimeout` method. This can only be done if the function has not already been executed. It uses the variable returned from `setTimeout()`
+
+```javascript
+var1 = setTimeout(() => {
+
+ console.log("Heloooo 7 !!!");
+
+}, 7000); /* This will print Hellooo !!! after 7 seconds */
+
+
+var2 = setTimeout(() => {
+
+ console.log("Heloooo 3 !!!");
+
+}, 3000); /* This will print Hellooo !!! after 3 seconds */
+
+clearTimeout(var1); /* this will not output Helooo 7 !!! */
+
+/* Output
+
+Heloooo 3!!!
+
+ */
+```
+
+
+## setInterval(function, milliseconds)
+
+ The `setInterval()` method runs a given function after specific interval of time till we stop the timer.
+
+ The setInterval function accepts two parameters:
+
+ - *function * : a function to be executed
+ - *milliseconds *: the length of the timeinterval between each execution.
+
+
+
+```javascript
+
+// setInterval This runs a code after specific interval of time till we stop the timer.
+starting = setInterval(() => {
+
+console.log("SetInterval is Called");
+
+}, 3000); // This will print setInterval is Called after every 3sec
+
+/* Output
+
+SetInterval is Called
+SetInterval is Called
+SetInterval is Called
+SetInterval is Called
+.
+.
+.
+ */
+
+```
+
+## Stopping the timer or Cancelling the setInterval method
+
+We can stop the interval and timeout using `clearInterval` method. It uses the variable returned from `setInterval`
+
+```javascript
+clearInterval(starting);
+```
diff --git a/docs/JavaScript_Advance_Info/while_loop.md b/docs/JavaScript_Advance_Info/while_loop.md
new file mode 100644
index 0000000..f295ef1
--- /dev/null
+++ b/docs/JavaScript_Advance_Info/while_loop.md
@@ -0,0 +1,10 @@
+# While Loop
+
+In a while loop, an expression (or condition) is evaluated. While this condition is true, the statement within the loop gets executed.
+
+
+### Structure:
+
+ while (condition) {
+ statement
+ }
diff --git a/docs/JavaScript_Basics/BOM_functions.md b/docs/JavaScript_Basics/BOM_functions.md
new file mode 100644
index 0000000..956ec9e
--- /dev/null
+++ b/docs/JavaScript_Basics/BOM_functions.md
@@ -0,0 +1,126 @@
+```js
+/* eslint-disable no-multi-spaces */
+/* eslint-disable no-unused-vars */
+
+// window is the global variable for Browser environment
+// to achive it user just need to type window
+
+/**
+ * sceen object contains main information about user device screen
+ * in modern world sites mostly relate to adaptive layout and rarery use such client information
+ * @return {availHeight} height of the screen in pixels without displayed user features (taskbar, etc.)
+ * @return {availWidth} amount of horizontal space in pixels available to the window
+ * @return {colorDepth} color depth of the screen.
+ * @return {height} height of the screen in pixels
+ * @return {width} width of the screen
+ * @return {orientation} ScreenOrientation instance with this screen
+ * @return {pixelDepth} bit depth of the screen
+ * Not standardized API
+ * @return {availLeft} the first available pixel available from the left side of the screen
+ * @return {availTop} the first available pixel available from the top side of the screen
+ */
+const {
+ availHeight,
+ availWidth,
+ colorDepth,
+ height,
+ width,
+ pixelDepth,
+ orientation,
+ availLeft,
+ availTop
+} = window.screen;
+
+/**
+ * window location is object provides interface and API to handle client url
+ * @return {assign} method to manual switch to another url location.assign(path_to_page)
+ * @return {reload} method to manual reload page(forse reload)
+ * @return {replace} method similar to assign
+ * @return {hash} field represent data in URL after #(hash) symbol
+ * @return {host} host value
+ * @return {hostname} host-name value
+ * @return {href} path to existed page
+ * @return {pathname} string from domen name to the existed page
+ * @return {port} port where page is places
+ * @return {protocol} network protocol http/s/2
+ * @return {search} get params of the page
+ */
+const {
+ assign,
+ reload,
+ replace,
+ hash,
+ host,
+ hostname,
+ href,
+ pathname,
+ port,
+ protocol,
+ search
+} = window.location;
+
+/* eslint-disable no-multiple-empty-lines */
+/* eslint-disable no-multi-spaces */
+/* eslint-disable no-trailing-spaces */
+
+/**
+ * History API
+ * Interface manipulates browser history in the session borders
+ *
+ * Fields
+ * @return {length} integer amount of elements in session history
+ * @return {state} field stories state existed page
+ *
+ * Methods
+ * @return {go} method loads a page from the session history with integer args
+ * @return {back} method goes to the previous page in session history the same as history.go(-1)
+ * @return {forfard} method goes to the next page in session history the same as history.go(1)
+ *
+ * @return {pushState} method pushes the given data onto the session history stack with the specified title and, if provided, URL
+ * @return {replaceState} updates the most recent entry on the history stack to have the specified data, title, and, if provided, URL
+ */
+
+window.history.back(); // goes to the previous page or do nothing if the existed page is first
+window.history.go(-1); // the same as above
+
+window.history.forward(); // goes to the next page or do nothing if the existed page is last
+window.history.go(1); // the same as above
+
+console.log(window.history.state); // null if not specified for existed page
+
+const stateData = "stateData";
+const title = "title"; // ignored FireFox
+const url = window.location.href; // url which can be used manually later if needs
+window.history.pushState(stateData, title, url);
+
+console.log(window.history.state === stateData); // true
+
+window.history.replaceState(stateData, title, url); // to update existed state
+
+
+/**
+ * Navigator API
+ * provides the user-agent information
+ * @return {userAgent} user agent string for the current browser
+ * @return {language} language of the browser UI
+ * @return {languages} list of languages known to the user
+ *
+ * Also contains a lot of user-agent information related to:
+ * - media devices
+ * - bluetooth
+ * - usb
+ * - geo location
+ * - etc.
+ *
+ * the full list of data is https://developer.mozilla.org/en-US/docs/Web/API/Navigator
+ *
+ * @return {serviceWorker} provides access to registration, removal, upgrade, and communication with service worker
+ */
+
+// usually is used custom function to define client browser type to specify which features can be used
+// mostly for IE
+const isIE = () => {
+ const isIE11 = navigator.userAgent.indexOf(".NET CLR") > -1;
+ const isIE11orLess = isIE11 || navigator.appVersion.indexOf("MSIE") !== -1;
+ return isIE11orLess;
+};```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/Cookies.md b/docs/JavaScript_Basics/Cookies.md
deleted file mode 100644
index 3f96867..0000000
--- a/docs/JavaScript_Basics/Cookies.md
+++ /dev/null
@@ -1,31 +0,0 @@
-# Math
-
-Javascript Math functions are useful for number calculus, for example:
-
-In this code we can use `floor` from Math to reduce the decimal number to the next low whole number.
-
-```javascript
-var n1 = 43.4
-
-var n2 = Math.floor(n1)
-console.log(n2) // Expect to be 43
-```
-
-On the other hand, we can use `cell` to get the next up whole number from a float number.
-
-```javascript
-var n1 = 43.6
-
-var n2 = Math.ceil(n2)
-console.log(n2) // Expect to be 44
-```
-
-To get a random number we can use `random` method
-
-```javascript
-var randomNumber = Math.random()
-console.log(randomNumber) // random number
-```
-
-
-
diff --git a/docs/JavaScript_Basics/Datatypes.md b/docs/JavaScript_Basics/Datatypes.md
new file mode 100644
index 0000000..5a6c4d9
--- /dev/null
+++ b/docs/JavaScript_Basics/Datatypes.md
@@ -0,0 +1,13 @@
+```js
+var length = 16; // Number
+var bigLength = BigInt(16); // BigInt
+var lastName = 'Johnson'; // String
+var x = { firstName: 'John', lastName: 'Doe' }; // Object
+var nullValue = null; // null
+var undefinedValue = undefined; // undefined
+var booleanValue = true; // Boolean
+var newSymbol = Symbol("I'm new in es6!"); // Symbol
+var notNumber = NaN; // Number
+
+// the type of every variable in javascript can be checked using typeof(var)
+```
diff --git a/JavaScript_Advance/arrayFlat.js b/docs/JavaScript_Basics/array_flat.md
similarity index 53%
rename from JavaScript_Advance/arrayFlat.js
rename to docs/JavaScript_Basics/array_flat.md
index 137fcb9..c4c3a66 100644
--- a/JavaScript_Advance/arrayFlat.js
+++ b/docs/JavaScript_Basics/array_flat.md
@@ -1,24 +1,25 @@
+```js
const array = [];
array.flat(); // This is array flat method came new in ES-2019
-
/**
- * The flat() method creates a new array with all sub-array elements concatenated into
+ * The flat() method creates a new array with all sub-array elements concatenated into
* it recursively up to the specified depth.
- *
+ *
*/
-const arr = [[1, 2, 3], ['a', 'b', 'c']]
+const arr = [[1, 2, 3], ["a", "b", "c"]];
-console.log(arr.flat()) // [1,2,3,'a','b','c']
+console.log(arr.flat()); // [1,2,3,'a','b','c']
-const arr1 = [[1, 2, 3], ['a', ['b', 'c']]]
+const arr1 = [[1, 2, 3], ["a", ["b", "c"]]];
// My default flat only work one level deep
-console.log(arr1.flat()) // [1,2,3,'a', ['b','c']]
+console.log(arr1.flat()); // [1,2,3,'a', ['b','c']]
// if you want to work on more level you can pass level etc. 2, 3
-console.log(arr1.flat(2)) // [1,2,3,'a', 'b','c']
+console.log(arr1.flat(2)); // [1,2,3,'a', 'b','c']
// if you want to work on n level you need to pass Infinity
-console.log(arr1.flat(Infinity)) // [1,2,3,'a', 'b','c']
+console.log(arr1.flat(Infinity)); // [1,2,3,'a', 'b','c']
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/array_methods.md b/docs/JavaScript_Basics/array_methods.md
new file mode 100644
index 0000000..a735abd
--- /dev/null
+++ b/docs/JavaScript_Basics/array_methods.md
@@ -0,0 +1,233 @@
+```js
+// 1. join() method
+const sayings = ["India", "is", "my", "country"];
+sayings.join(" - ");
+//Output : India-is-my-country
+
+// 2. concat() method
+var flowers = ["Rose", "Lotus"];
+var leaf = ["green", "lightgreen", "Darkgreen"];
+var garden = flowers.concat(leaf);
+//Output : Rose ,Lotus,green,lightgreen Darkgreen
+
+
+// 3. copyWithin() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+Country.copyWithin(2, 0); // Output : India , Us , India , Us
+
+// 4.fill() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+Country.fill("Canada"); // Output : Canada, Canada , Canada, Canada
+
+// 5. find() method
+var years = [2000, 2001, 2002, 2003];
+console.log(years); // Output : 2000,2001,2002,2003
+function checkYear(year) {
+ return year >= 2002;
+}
+years.find(checkYear); // Output: 2002
+
+// 6. findIndex()method
+var years = [2000, 2001, 2002, 2003];
+console.log(years); // Output : 2000,2001,2002,2003
+function checkYear(year) {
+ return year >= 2002;
+}
+years.findIndex(checkYear); // Output: 2
+
+// 7.forEach() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+Country.forEach(countryFunction);
+
+function countryFunction(item) {
+ console.log(item) // Output: India , Us , German , Australia
+}
+
+// 8. isArray() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+Array.isArray(Country); //Output: true
+
+// 9.includes() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+var avail = Country.includes("Australia");
+console.log(avail); // Output : true
+
+// 10. IndexOf() method
+var Country = ["India", "US", "German", "Australia"];
+console.log(Country); // Output : India , Us , German , Australia
+var iof = Country.indexOf("Australia");
+console.log(iof); // Output : 3
+
+
+// 11 map() method
+var numbers = [1, 2, 3, 4, 5];
+console.log(numbers); //[1,2,3,4,5]
+function double(num) {
+ return num * 2;
+}
+numbers = numbers.map(double);
+console.log(numbers); //[2,4,6,8,10]
+
+
+{
+ // 12 Array.prototype.reduce() Method
+ // This method is used to generate a single output from the array
+ let toReduceArray = [1, 2, 3, 4, 5];
+ console.log("\nArray that will implement .reduce()")
+ console.log(toReduceArray);
+
+ function callbackFunctionForReduce(accumulator, currentValue) {
+ return accumulator + currentValue.toString();
+ }
+ let reducedArray = toReduceArray.reduce(callbackFunctionForReduce);
+ console.log("Reduced array is: ");
+ console.log(reducedArray);
+}
+
+{
+ // 13 Array.prototype.reduceRight() Method
+ // This method is used to generate a single output from array by processing it from right to left
+ let toReduceArray = [1, 2, 3, 4, 5];
+ console.log("\nArray that will implement .reduceRight()")
+ console.log(toReduceArray);
+
+ function callbackFunctionForReduceRight(accumulator, currentValue) {
+ return accumulator + currentValue.toString();
+ }
+ let reducedArray = toReduceArray.reduceRight(callbackFunctionForReduceRight);
+ console.log("Reduced array is: ");
+ console.log(reducedArray);
+}
+
+{
+ //14 Array.prototype.some()
+ // Checks whether at least one element in the array passes the test given as a parameter
+ let toCheckArray = [1, 2, 3, 4, 5];
+ console.log('Array to be checked for containing a multiple of 2 is:');
+ console.log(toCheckArray);
+
+ function checkingFunction(input) {
+ // Checks if the value is multiple of 2;
+ return ((input % 2) === 0);
+ }
+ console.log('Result is: ');
+ console.log(toCheckArray.some(checkingFunction));
+}
+
+{
+ //15 Array.prototype.lastIndexOf()
+ // Finds the first element supplied as parameter from the last posistion in the array
+ let containingArray = [1, 7, 6, 8, 7];
+ console.log("the array that contains 7 two times in position 1,4 is: ");
+ console.log(containingArray);
+ console.log('The last posistion of 7 in array according to lastIndexOf() is: ');
+ console.log(containingArray.lastIndexOf(7));
+}
+
+{
+ //16 Array.prototype.every()
+ //Checks if all the elements in array passes the condition implemented by the function given as parameter
+ let fullfillingArray = [2, 4, 6, 8, 10];
+ console.log('Array with all even numbers is: ');
+ console.log(fullfillingArray);
+
+ function checkIfEven(num) {
+ return ((num % 2) === 0);
+ }
+ console.log('Check if all elements in array are even:');
+ console.log(fullfillingArray.every(checkIfEven));
+}
+
+{
+ //17 Array.prototype.filter()
+ //returns all the elements in array that pass the test implemented by function passed as parameter
+ let evenOddArray = [1, 2, 3, 4, 5, 6, 7, 8, 9];
+ console.log('the array from which to return all even numbers is: ');
+ console.log(evenOddArray);
+ console.log('Filetered array is: ');
+ console.log(evenOddArray.filter(checkIfEven));
+}
+
+{
+ //18 Array.prototype.flat()
+ // This function returns the array with the consitituents array elements
+ let arrayToFlatten = [
+ [1, 3, 5, 7, 9],
+ [2, 4, 6, 8]
+ ];
+ console.log('Array to flatten is: ');
+ console.log(arrayToFlatten);
+ console.log('Flattened array is: ');
+ console.log(arrayToFlatten.flat());
+ // an index is passed into the method that instructs the depth till which to flatten
+ arrayToFlatten = [
+ [
+ [1],
+ [3],
+ [5],
+ [7],
+ [9]
+ ],
+ [
+ [2],
+ [4],
+ [6],
+ [8]
+ ]
+ ];
+ console.log("Deepended array is: ");
+ console.log(arrayToFlatten);
+ console.log('Array flattened to depth of 1 is: ');
+ console.log(arrayToFlatten.flat(1));
+}
+
+{
+ //19 Array.prototype.shift()
+ // this functions removes the element from index 0 and returns it. It is similar to pop but it removes from left
+ let originalArray = [1, 2, 3, 4, 5, 6, 7, 8, 9];
+ console.log('Original array is:');
+ console.log(originalArray);
+ console.log('The element removed after shift is: ', originalArray.shift());
+ console.log('Array after shifting is:');
+ console.log(originalArray);
+}
+
+{
+ //20 Array.prototype.unshift()
+ // this functions adds the element to index 0 and returns array. It is similar to push but it adds to left
+ let originalArray = [3, 4, 5, 6, 7, 8, 9];
+ console.log('Original array is:');
+ console.log(originalArray);
+ console.log('Elements to be added in front are 1,2');
+ originalArray.unshift(1, 2);
+ console.log('Array after unshifting is:');
+ console.log(originalArray);
+}
+
+{
+ //21 Array.prototype.push();
+ // this function adds elements to the end of the array;
+ let originalArray = [1, 2, 3, 4, 5, 6, 7];
+ console.log('Original array is:');
+ console.log(originalArray);
+ console.log('Elements to be pushed are: 8,9');
+ originalArray.push(8, 9);
+ console.log('Array after push is: ');
+ console.log(originalArray);
+}
+
+{
+ //22 Array.prototype.pop();
+ // this function removes elements from the end of array;
+ let originalArray = [1, 2, 3, 4, 5, 6, 7, 8, 9, 1];
+ console.log('Original array is:');
+ console.log(originalArray);
+ console.log('The element removed after pop is: ', originalArray.pop());
+ console.log('Array after pop is:');
+ console.log(originalArray);
+}```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/arrays.md b/docs/JavaScript_Basics/arrays.md
index b0de00e..740b32d 100644
--- a/docs/JavaScript_Basics/arrays.md
+++ b/docs/JavaScript_Basics/arrays.md
@@ -1 +1,99 @@
-# Arrays
+````js
+// Javascript arrays can take any values in the same array
+// We don't have to specify the size
+const a = ["hii", 26, "Swapnil"];
+
+console.log(a);
+// Output [ 'hii', 26, 'Swapnil' ]
+console.log(a.length); // This will print the size of array
+// Output 3
+
+const Student = []; // Created Empty array
+
+// Here we are pushing one by one element
+Student.push("Swapnil Satish Shinde"); // Pushed the Name
+
+Student.push(76); // Pushed rollno
+
+Student.push(true); // Pushed true
+
+console.log(Student); // Print Whole array
+// Output [ 'Swapnil Satish Shinde', 76, true ]
+
+const easyMethod = []; // Created Empty array
+
+easyMethod.push("Swapnil Satish Shinde", 76, true); // This way you can push Multiple Values at once.
+
+console.log(easyMethod);
+// Output [ 'Swapnil Satish Shinde', 76, true ]
+
+// The pop() method removes the last element from an array:
+const fruits = ["Banana", "Orange", "Apple", "Mango"];
+fruits.pop(); // Removes the last element ("Mango") from fruits and output is ["Banana","Orange","Apple"]
+
+// Shifting is equivalent to popping, working on the first element instead of the last.
+// The shift() method removes the first array element and "shifts" all other elements to a lower index.
+const cars = ["Acura", "Audi", "Bugatti", "Honda"];
+cars.shift(); // Removes the first element ("Acura") from cars and output is ["Audi","Bugatti","Honda"]
+
+// The length property provides an easy way to append a new element to an array:
+const mobiles = ["Apple", "Nokia", "Samsung", "Sony"];
+mobiles[mobiles.length] = "HTC"; // Appends "HTC" to mobiles and output is ["Apple", "Nokia", "Samsung", "Sony", "HTC"]
+
+// delete will delete the object property, but will not reindex the array or update its length. This makes it appears as if it is undefined:
+const myArray = ["a", "b", "c", "d"];
+delete myArray[0];
+"The first value is: " + myArray[0]; // The first value is: undefined
+// Using delete may leave undefined holes in the array. Use pop() or shift() instead.
+
+// The splice() method removes items from array and/or adds items to array and returns the removed items:
+const names = ["Anne", "Belle", "Chloe", "Diane", "Ella", "Frances"];
+names.splice(4, 1);
+// This removes 1 item from index 4
+// returns "Ella"
+// names is now ["Anne", "Belle", "Chloe", "Diane", "Frances"]
+
+names.splice(-2);
+// This removes all items from index -2
+// returns ["Diane", "Frances"]
+// names is now ["Anne", "Belle", "Chloe"]
+
+names.splice(0, 2, "Annabelle");
+// This removes 2 items from index 0 and adds "Annabelle" in its place
+// returns []
+// names is now ["Annabelle", "Chloe"]
+
+names.splice(1, 0, "Beatriz");
+// This removes 0 items from index 1 and add s "Beatriz" in its place
+// returns []
+// names is now ["Annabelle", "Beatriz", "Chloe"]
+
+// The concat() method returns a new array of two or more arrays joined together:
+const evenNumbers = [4, 36, 52, 68];
+const oddNumbers = [9, 29, 499];
+const moreOddNumbers = [1, 3, 5];
+evenNumbers.concat(oddNumbers, moreOddNumbers);
+// returns [4, 36, 52, 68, 9, 29, 499, 1, 3, 5]
+
+// The slice() method returns a new array from a selected range:
+const languages = ["JavaScript", "Python", "C", "PHP"];
+languages.slice(2);
+// This selects languages[2] onwards
+// returns ["C", "PHP"]
+
+languages.slice(1, 3);
+// This selects languages[1] to the element before languages[3]
+// returns ["Python", "C"]
+
+languages.slice(-3, -1);
+// This selects languages[-3] to the element before languages[-1]
+// returns ["Python", "C"] which is the same as above
+
+// To get an array copy
+const arrayCopy = [...languages]
+// This ... copuy the array by value
+console.log(arrayCopy);
+
+// Get a reverse copy of array
+const reverseArray = languages.reverse();
+console.log(reverseArray);````
\ No newline at end of file
diff --git a/JavaScript_Basics/bitwise-operators.js b/docs/JavaScript_Basics/bitwise_operators.md
similarity index 62%
rename from JavaScript_Basics/bitwise-operators.js
rename to docs/JavaScript_Basics/bitwise_operators.md
index d93fad2..0d8c93c 100644
--- a/JavaScript_Basics/bitwise-operators.js
+++ b/docs/JavaScript_Basics/bitwise_operators.md
@@ -1,7 +1,8 @@
+```js
console.log(5 & 13); // 0101 & 1101 = 0101
// expected output: 5;
-console.log(parseInt("0101",2) & parseInt("1101",2));
+console.log(parseInt("0101", 2) & parseInt("1101", 2));
// expected output: 5;
console.log(5 & 13 & 3); // 0101 & 1101 & 0011 = 0001
@@ -14,35 +15,32 @@ Bitwise operators treat their operands as a sequence of 32 bits (zeroes and ones
or octal numbers. For example, the decimal number nine has a binary representation of 1001.
Bitwise operators perform their operations on such binary representations,but they return standard JavaScript numerical values.
*/
-/*Bitwise AND
-When a bitwise AND is performed on a pair of bits, it returns 1 if both bits are 1.*/
+/* Bitwise AND
+When a bitwise AND is performed on a pair of bits, it returns 1 if both bits are 1. */
var x = 5 & 1; // outputs 1
-/*Bitwise OR
-Bitwise OR returns 1 if one of the bits are 1:*/
+/* Bitwise OR
+Bitwise OR returns 1 if one of the bits are 1: */
var x = 5 | 1; // outputs 5
-/*JavaScript Bitwise XOR (^)
-Bitwise OR returns 1 if one of the bits are 1:*/
+/* JavaScript Bitwise XOR (^)
+Bitwise OR returns 1 if one of the bits are 1: */
var x = 5 ^ 1; // outputs 4
-/*JavaScript Bitwise NOT (~)
+/* JavaScript Bitwise NOT (~)
var x = ~5; // outputs -6
/*JavaScript (Zero Fill) Bitwise Left Shift (<<)
-This is a zero fill left shift. One or more zero bits are pushed in from the right, and the leftmost bits fall off:*/
-var x = 5 << 1; //outputs 10
+This is a zero fill left shift. One or more zero bits are pushed in from the right, and the leftmost bits fall off: */
+var x = 5 << 1; // outputs 10
-/*JavaScript (Sign Preserving) Bitwise Right Shift (>>)
-This is a sign preserving right shift. Copies of the leftmost bit are pushed in from the left, and the rightmost bits fall off:*/
+/* JavaScript (Sign Preserving) Bitwise Right Shift (>>)
+This is a sign preserving right shift. Copies of the leftmost bit are pushed in from the left, and the rightmost bits fall off: */
var x = -5 >> 1; // outputs -3
-/*JavaScript (Zero Fill) Right Shift (>>>)
-This is a zero fill right shift. One or more zero bits are pushed in from the left, and the rightmost bits fall off:*/
-var x = 5 >>> 1; // outputs 2
-
-
-
+/* JavaScript (Zero Fill) Right Shift (>>>)
+This is a zero fill right shift. One or more zero bits are pushed in from the left, and the rightmost bits fall off: */
+var x = 5 >>> 1; // outputs 2```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/boolean.md b/docs/JavaScript_Basics/boolean.md
new file mode 100644
index 0000000..b66d930
--- /dev/null
+++ b/docs/JavaScript_Basics/boolean.md
@@ -0,0 +1,18 @@
+```js
+// JavaScript Boolean data type can store one of two values, true or false. ... e.g.
+const YES = new Boolean(true);
+
+// It can be declare to this way too
+var negativeVariable = false;
+
+//You can use the operator '!' to invert the value of the boolean
+console.log(!sunnyDay) // Output: {true}
+
+//also you can use the operator '||' or '&&' to envolv the result of two booleans in one value
+var positiveVariable = true;
+console.log(negativeVariable || positiveVariable) //Output: {true}
+console.log(negativeVariable && positiveVariable) //Output: {false}
+
+// JavaScript treats an empty string (""), 0, undefined and null as false.
+
+// Everything else is true.```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/bugs.md b/docs/JavaScript_Basics/bugs.md
new file mode 100644
index 0000000..d28d317
--- /dev/null
+++ b/docs/JavaScript_Basics/bugs.md
@@ -0,0 +1,9 @@
+```js
+const obj = {
+ name: "Some name"
+};
+
+const name = null;
+
+console.log(typeof obj); // object;
+console.log(typeof name); // object;```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/call.md b/docs/JavaScript_Basics/call.md
new file mode 100644
index 0000000..3ea01a1
--- /dev/null
+++ b/docs/JavaScript_Basics/call.md
@@ -0,0 +1,21 @@
+```js
+const person = {
+ greetings: function () {
+ return `Hello, my name is ${this.name} and i'm ${this.age} years old`;
+ }
+};
+
+// Function to count years of birth
+const countAge = (yearsOfBirth) => {
+ return new Date().getFullYear() - yearsOfBirth;
+};
+
+// Object of arguments to the actual function
+const person1 = {
+ name: "Masyoudi",
+ age: countAge(1997)
+};
+
+const greeting = person.greetings.call(person1);
+
+console.log(greeting);```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/classes.md b/docs/JavaScript_Basics/classes.md
deleted file mode 100644
index 87846ef..0000000
--- a/docs/JavaScript_Basics/classes.md
+++ /dev/null
@@ -1 +0,0 @@
-# Classes
diff --git a/JavaScript_Basics/comparisonOperators.js b/docs/JavaScript_Basics/comparison_operators.md
similarity index 66%
rename from JavaScript_Basics/comparisonOperators.js
rename to docs/JavaScript_Basics/comparison_operators.md
index 65420e2..d0554ff 100644
--- a/JavaScript_Basics/comparisonOperators.js
+++ b/docs/JavaScript_Basics/comparison_operators.md
@@ -1,11 +1,12 @@
+```js
const comparisonOperators = () => {
- console.log(1 != 2); //inequality operator
- console.log(1 != "1"); //inequality operator
- console.log(1 != true); //inequality operator
- console.log(0 != false); //inequality operator
+ console.log(1 !== 2); // inequality operator
+ console.log(1 != "1"); // inequality operator
+ console.log(1 != true); // inequality operator
+ console.log(0 != false); // inequality operator
console.log(1 !== 5); // strict typecheck inequality operator
console.log(5 !== "5"); // strict typecheck inequality operator
- console.log(1 == 8); // equality operator
+ console.log(1 === 8); // equality operator
console.log(5 == "5"); // equality operator
console.log(5 === 5); // strict typecheck equality operator
console.log(5 === "5"); // strict typecheck equality operator
@@ -15,4 +16,4 @@ const comparisonOperators = () => {
console.log(3 <= 1); // less than or equal to
};
-comparisonOperators();
+comparisonOperators();```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/continue_break.md b/docs/JavaScript_Basics/continue_break.md
new file mode 100644
index 0000000..c715c11
--- /dev/null
+++ b/docs/JavaScript_Basics/continue_break.md
@@ -0,0 +1,64 @@
+```js
+/*
+ * Usage of continue and break
+*/
+
+// Break examples
+// --------------
+const helloWorld = "Hello, world!".split("");
+while (helloWorld.length > 0) {
+ if (helloWorld[0] == ",") { break; }
+ console.log(helloWorld.shift());
+}
+// Will output: *'Hello'* with a carriage return between each letters.
+
+const color = "red";
+switch (color) {
+case "red":
+case "yellow":
+case "blue":
+ console.log(color + " is a primary color");
+ break;
+case "green":
+case "purple":
+case "orange":
+ console.log(color + " is a secondary color");
+ break;
+default:
+ console.log("Sorry, I don't know this color...");
+ break;
+}
+// Will output: *'red is a primary color'*.
+
+const array = [1, 2, 3, 4, 5];
+const array2 = [];
+firstFor: for (let i = 0; i < array.length; i++) {
+ for (let j = 0; j < array.length; j++) {
+ if (array[i] * array[j] > 5) { break firstFor; }
+ array2.push(array[i] * array[j]);
+ }
+}
+console.log(array2);
+// Will output: *'[1, 2, 3, 4, 2, 4]'* with 'break firstFor;' and *'[1, 2, 3, 4, 2, 4, 3, 4]'* with a simple break statement.
+
+// Continue examples
+// -----------------
+let result1 = "";
+for (let i = 0; i < 5; i++) {
+ if (i === 3) { continue; }
+ result1 = result1 + i;
+}
+console.log(result1);
+// Will output: *0124*, the digit `3` is ommited because of the continue statement.
+
+const result2 = [];
+firstFor: for (let i = 0; i < 5; i++) {
+ let numbers = "";
+ for (let j = 0; j < 2; j++) {
+ if (i === 3) { continue firstFor; }
+ numbers = numbers + " " + (i + j);
+ }
+ result2.push(numbers.trim());
+}
+console.log(result2);
+// Will output: *'["0 1", "1 2", "2 3", "4 5"]'* with 'continue firstFor' and *'["0 1", "1 2", "2 3", "", "4 5"]'* with a simple continue statement.```
\ No newline at end of file
diff --git a/JavaScript_Advance/countRepeatedValues.js b/docs/JavaScript_Basics/count_repeated_values.md
similarity index 51%
rename from JavaScript_Advance/countRepeatedValues.js
rename to docs/JavaScript_Basics/count_repeated_values.md
index 53bf01d..c8f3812 100644
--- a/JavaScript_Advance/countRepeatedValues.js
+++ b/docs/JavaScript_Basics/count_repeated_values.md
@@ -1,11 +1,12 @@
+```js
// You have array of repeated elements and you want to count repeated values
// lets take hashtags for example
-const allHashTags = ['#ht1', '#ht2', '#ht3', '#ht1', '#ht2', '#ht1', '#ht1'];
-console.log(allHashTags) // ['#ht1', '#ht2', '#ht3', '#ht1', '#ht2', '#ht1', '#ht1'];
+const allHashTags = ["#ht1", "#ht2", "#ht3", "#ht1", "#ht2", "#ht1", "#ht1"];
+console.log(allHashTags); // ['#ht1', '#ht2', '#ht3', '#ht1', '#ht2', '#ht1', '#ht1'];
// We will do that in oneliner with help of reduce
-const hashtags = allHashTags.reduce((acum, cur) => Object.assign(acum, {[cur]: (acum[cur] | 0)+1 }), {});
+const hashtags = allHashTags.reduce((acum, cur) => Object.assign(acum, { [cur]: (acum[cur] | 0) + 1 }), {});
// at the end you got object with unique hashtags with ther repeat values
-console.log(hashtags) // { '#ht1': 4, '#ht2': 2, '#ht3': 1 }
\ No newline at end of file
+console.log(hashtags); // { '#ht1': 4, '#ht2': 2, '#ht3': 1 }```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/date.md b/docs/JavaScript_Basics/date.md
index 0bb0513..b998802 100644
--- a/docs/JavaScript_Basics/date.md
+++ b/docs/JavaScript_Basics/date.md
@@ -1 +1,40 @@
-# Date
\ No newline at end of file
+```js
+// The Date object in JavaScript is used to work with dates and times.
+
+// Current time
+const date = new Date(); // The date object initialization
+console.log(date); // current time and date in your local time zone
+
+// Create a date object
+const dateWithYear = new Date(2019, 10, 10, 22, 10, 0); // takes year, month, date, hour, minute, second, millisecond as arguments
+console.log(dateWithYear); // Output : Sun Nov 10 2019 22:10:00 GMT+0530
+
+const dateString = new Date("October 10, 2019 11:13:00");
+console.log(dateString); // Output : creates a new date object from date string
+
+const dateMilli = new Date(100000000000); // adds 100000000000 ms to 01 January 1970
+console.log(dateMilli); // approximately October 31 1966
+
+const isoDate = new Date("2019-10-10"); // The ISO 8601 syntax (YYYY-MM-DD)
+console.log(isoDate); // 2019-10-10
+
+const shortDate = new Date("03/25/2015"); // "MM/DD/YYYY" date format
+console.log(shortDate); // Thu Jan 01 1970 05:30:00 GMT+0530
+
+const longDate = new Date("Oct 10 2019"); // "MM DD YYYY" date format
+console.log(longDate); // Sun Oct 10 2010 00:00:00 GMT+0530
+
+// Get Methods
+date.getFullYear(); // 2019 (the year of a date as a four digit number)
+
+date.getMonth(); // 9 (month of a date as a number (0-11))
+
+date.getTime(); // 1570726799950 (the number of milliseconds since midnight Jan 1 1970, and a specified date)
+
+// Manipulate a date
+
+date.setFullYear(2020, 10, 3); // Set the date to November 3, 2020
+
+date.setMonth(4); // Set the month to 4 (May)
+
+date.setTime(1332403882588); // Thu Mar 22 2012 13:41:22 GMT+0530```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/do_while_loop.md b/docs/JavaScript_Basics/do_while_loop.md
new file mode 100644
index 0000000..496b735
--- /dev/null
+++ b/docs/JavaScript_Basics/do_while_loop.md
@@ -0,0 +1,18 @@
+```js
+/* STRUCTURE:
+do {
+ statement
+ } while (condition)
+
+ In a do...while loop, a statement gets executed until the condition is proven false.
+
+ EXAMPLE:
+
+ */
+
+let n = 1;
+
+do {
+ console.log("n is less than 6. n = " + n);
+ n++;
+} while (n < 6);```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/dom_manipulation.md b/docs/JavaScript_Basics/dom_manipulation.md
new file mode 100644
index 0000000..3290ae8
--- /dev/null
+++ b/docs/JavaScript_Basics/dom_manipulation.md
@@ -0,0 +1,133 @@
+```js
+// Top most tree nodes
+const html = document.documentElement; // The topmost document node.
+const body = document.body; // To access body of the page. It can be null. That means it doen't exist.
+const head = document.head; // To access head tag of the page.
+
+// DOM navigation
+const parentNode = document.parentNode;
+const firstChild = document.firstChild;
+const lastChild = document.lastChild;
+const nextSibling = document.nextSibling;
+const previousSibling = document.previousSibling;
+
+// Element-only navigation
+const parentElement = document.parentElement;
+const firstElementChild = document.firstElementChild;
+const lastElementChild = document.lastElementChild;
+const nextElementSibling = document.nextElementSibling;
+const previousElementSibling = document.previousElementSibling;
+
+// DOM collections
+const childNode = document.body.childNodes;
+const tableBodies = table.tBodies;
+const tableRows = table.rows;
+const trCollection = tbody.rows;
+const trCells = tr.cells;
+
+/*
+Example html template
+
+ ...
+
+
+
+
one
+
two
+
+
+
three
+
four
+
+
+
+
+
+*/
+
+// DOM manipulation methods for web developers
+
+/**
+ * In many cases you may want to manipulate HTML elements on the screen
+ * in order to add extra functionalities to a site.
+ *
+ *
+ * Here is a few JavaScripts Method that aid DOM manipulation.
+ */
+
+
+// Query selector
+
+/**
+ * Syntax:
+ *
+ */
+var elementName = document.querySelector(selectorType);
+
+/**
+ * Query selector gets the first element that matches one or more CSS selectors.
+ * If no match is found, it returns null.
+ */
+
+/**
+ * Example:
+ *
div one
+ *
div two
+ *
div three
+ *
paragraph one
+ *
div four
+ *
paragraph three
+ */
+
+var firstDiv = document.querySelector('div');
+firstDiv.style.color = 'red';
+
+var firstP = document.querySelector('p');
+firstDiv.style.color = 'blue';
+
+
+ // Query Selector All
+
+ /**
+ * Syntax:
+ *
+ */
+ var elements = document.querySelectorAll(selectorType);
+
+ /**
+ * It returns all elements that match the specified CSS selector
+ */
+
+/**
+ * Example:
+ *
div one
+ *
div two
+ *
div three
+ *
paragraph one
+ *
div four
+ *
paragraph three
+ */
+
+var divs = document.querySelectorAll('div');
+for(var singleDiv of divs)
+singleDiv.style.color = 'blue';
+
+ // Query selectorAll
+
+ /**
+ * Syntax:
+ *
+ */
+
+ var pElement = document.createElement('p')
+
+ /**
+ * It creates a new HTML element using the name of the HTML tag to be created.
+ */
+
+
+// See more at https://www.hongkiat.com/blog/dom-manipulation-javascript-methods/```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/exercise-1-using-classes.md b/docs/JavaScript_Basics/exercise-1-using-classes.md
deleted file mode 100644
index 80448be..0000000
--- a/docs/JavaScript_Basics/exercise-1-using-classes.md
+++ /dev/null
@@ -1 +0,0 @@
-# Exercise 1 Using Classes
diff --git a/docs/JavaScript_Basics/exercise-1-using-object.md b/docs/JavaScript_Basics/exercise-1-using-object.md
deleted file mode 100644
index 002f6e6..0000000
--- a/docs/JavaScript_Basics/exercise-1-using-object.md
+++ /dev/null
@@ -1 +0,0 @@
-# Exercise 1 Using Object
diff --git a/docs/JavaScript_Basics/exercise-1.md b/docs/JavaScript_Basics/exercise-1.md
deleted file mode 100644
index ff78e6f..0000000
--- a/docs/JavaScript_Basics/exercise-1.md
+++ /dev/null
@@ -1 +0,0 @@
-# Exercise 1
diff --git a/docs/JavaScript_Basics/filter.md b/docs/JavaScript_Basics/filter.md
index 75293f0..ac5dc28 100644
--- a/docs/JavaScript_Basics/filter.md
+++ b/docs/JavaScript_Basics/filter.md
@@ -1,37 +1,26 @@
+```js
+// JavaScript Array filter() Method
-**JavaScript Array filter() Method**
-
-The filter() method creates a new array with all elements that
+/* The filter() method creates a new array with all elements that
pass the test implemented by the provided function.
+*/
+const words = ["spray", "limit", "elite", "exuberant", "destruction", "present"];
+const result = words.filter(word => word.length > 6);
-
-
- let words = ['spray', 'limit', 'elite', 'exuberant', 'destruction', 'present'];
- const result = words.filter(word => word.length > 6);
- console.log(result);
-
-
-
-> expected output: Array ["exuberant", "destruction", "present"]
-
-
-
-*Another example*
+console.log(result);
+// expected output: Array ["exuberant", "destruction", "present"]
+/*
+Another example
Filtering out all small values
-
-The following example uses filter() to create a filtered array that has all elements with values less than 10 removed.
-
-
-
- function isBigEnough(value) {
-
- return value >= 10;
-
- }
-
- var filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
-
-> filtered is [12, 130, 44]
+The following example uses filter() to create a filtered array that has all elements
+with values less than 10 removed.
+*/
+function isBigEnough (value) {
+ return value >= 10;
+}
+
+const filtered = [12, 5, 8, 130, 44].filter(isBigEnough);
+// filtered is [12, 130, 44]```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/filtering_array.md b/docs/JavaScript_Basics/filtering_array.md
new file mode 100644
index 0000000..5994a89
--- /dev/null
+++ b/docs/JavaScript_Basics/filtering_array.md
@@ -0,0 +1,21 @@
+```js
+const animals = ["cats", "dogs", "bunnies", "birds"];
+
+const start_with_b = animals.filter(name => name.indexOf("b") === 0);
+
+console.log(start_with_b); // ['bunnies', 'birds']
+
+// function of filter (basic callback for filter)
+const arr = [1, 3, 42, 2, 4, 5];
+function filter (array, callback) {
+ const callback_list = [];
+ for (const i of array) {
+ callback_list.push(callback(i));
+ }
+ return callback_list;
+}
+// modifyable callback function
+function callback (num) {
+ return Math.pow(num, 2);
+}
+console.log(filter(arr, callback));```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/forEach.md b/docs/JavaScript_Basics/forEach.md
deleted file mode 100644
index 95ae9fe..0000000
--- a/docs/JavaScript_Basics/forEach.md
+++ /dev/null
@@ -1,22 +0,0 @@
-
-**Map.forEach method in JavaScript**
-
-The forEach() method executes a provided function once per each
-
-key/value pair in the Map object, in insertion order.
-
- function logMapElements(value, key, map) {
-
- console.log(`map.get('${key}') = ${value}`);
-
- }
-
- new Map([['foo', 3], ['bar', {}], ['baz', undefined]]).forEach(logMapElements);
-
-> logs:
->
-> "map.get('foo') = 3"
->
-> "map.get('bar') = [object Object]"
->
-> "map.get('baz') = undefined"
diff --git a/JavaScript_Advance/fsModule.js b/docs/JavaScript_Basics/fs_module.md
similarity index 95%
rename from JavaScript_Advance/fsModule.js
rename to docs/JavaScript_Basics/fs_module.md
index 74110e3..3ce93a9 100644
--- a/JavaScript_Advance/fsModule.js
+++ b/docs/JavaScript_Basics/fs_module.md
@@ -1,3 +1,4 @@
+```js
// Fs is a inbuilt function in nodejs to perform operations on files
// There are always two ways to do fs operation as sync and async
@@ -44,4 +45,4 @@ fsModule
File ends
*/
-// This is a kind of publish , subscribe system our stream is subscriber and file is publisher we can use that using MQTT
\ No newline at end of file
+// This is a kind of publish , subscribe system our stream is subscriber and file is publisher we can use that using MQTT```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/functions.md b/docs/JavaScript_Basics/functions.md
index 0c5faf5..5f4e241 100644
--- a/docs/JavaScript_Basics/functions.md
+++ b/docs/JavaScript_Basics/functions.md
@@ -1 +1,64 @@
-# Functions
+```js
+// Functions in Javascript
+// Functions are used to structure and generalize the code. It will become more flexible and you will have a better overview.
+
+/* What is a function?
+A Function is a type of varable which essentially contains code you can run.
+There are different ways to write code into a variable (declare a function).
+*/
+
+function foo () { // Puts codes inside if the curly brackets into the variable "foo".
+ console.log("Hello World")
+}
+
+// Shows that "foo" is a variable with the type function
+console.log(typeof foo) // "function"
+console.log(typeof 1) // "number"
+console.log(typeof "hello") // "string"
+
+/* How to call a function?
+The function is defined. Now we want to execute the code inside the Function
+*/
+
+// The most common way to execute a function by appending the variable name with brackets
+foo() // "Hello World"
+
+/* Functions with output
+Printing text is acually the wrong format of getting informations out of variables.
+To get usable informations back we can use the return keyword.
+*/
+
+// Nothing is returned -> x is empty
+x = foo() // "Hello World" and x: undefined
+
+
+function foo () { // get a value from the inside of the function to te outside.
+ text = "Hello World"
+ return text
+}
+
+// text is returned, nothing prited into the console.
+x = foo() // x: "Hello World"
+
+// You can see that variables from inside the function are not accessible anymore
+console.log(text) // undefined
+// the string from the "text" variable was retuned an is now "x"
+console.log(x) // "Hello World"
+
+/* Functions with input
+Input for functions is called parameters.
+When you define the function you can also define what input variables the function can have.
+That is the purpose of the "()". "()" means no input both wen you define and call a function.
+*/
+
+// define with parameters
+function add(a, b) { // in the "()" you define what variable names the inputs get. Multiple parameters are septerated by a ","
+ c = a + b // add the value of the two variables
+ return c
+}
+
+// call with parameters
+// Depending on the sequence, the values separated by a "," are assigned to the parameter variables.
+// a = 5; b = 8;
+result = add(5, 8) // result: 13
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/higherOrderFunctions.md b/docs/JavaScript_Basics/higherOrderFunctions.md
deleted file mode 100644
index 8768c4a..0000000
--- a/docs/JavaScript_Basics/higherOrderFunctions.md
+++ /dev/null
@@ -1 +0,0 @@
-# Higher Order Functions
\ No newline at end of file
diff --git a/JavaScript_Basics/higherOrderFunctions.js b/docs/JavaScript_Basics/higher_order_functions.md
similarity index 92%
rename from JavaScript_Basics/higherOrderFunctions.js
rename to docs/JavaScript_Basics/higher_order_functions.md
index f33e55f..f28d814 100644
--- a/JavaScript_Basics/higherOrderFunctions.js
+++ b/docs/JavaScript_Basics/higher_order_functions.md
@@ -1,9 +1,10 @@
+```js
// HIGHER ORDER FUNCTIONS FOR ARRAYS
// the arrays in javascript have 3 main HOF
// SUCH MAP, FILTER AND REDUCE
-const list = [1,2,3,4,5]
+const list = [1, 2, 3, 4, 5];
// map
@@ -14,8 +15,8 @@ const list = [1,2,3,4,5]
// 3rd arg is the entire list [1,2,3,4,5]
const newList = list.map(function (item, index, list) {
- return item * 2
-})
+ return item * 2;
+});
// this return a new array with new values like [2, 4, 6, 8, 10]
@@ -29,7 +30,7 @@ const newList = list.map(function (item, index, list) {
const newListFiltered = list.map(function (item, index, list) {
// condition to return a value for the new array
- return item % 2 === 0
+ return item % 2 === 0;
})
// this return a new array with some filtered values based on a condition [2, 4]
@@ -41,6 +42,7 @@ const newListFiltered = list.map(function (item, index, list) {
// if you don't add a function sort numbers in incremental way and text in alphabetic way
// the sort receive a function that receives 3 arguments
-[1, 10, 2, 21].sort()
+ [1, 10, 2, 21].sort();
// this return [1, 10, 2, 21]
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/if.md b/docs/JavaScript_Basics/if.md
index 009b493..a7bf661 100644
--- a/docs/JavaScript_Basics/if.md
+++ b/docs/JavaScript_Basics/if.md
@@ -1 +1,33 @@
-# IF, ELSE IF, ELSE CONDITION
\ No newline at end of file
+```js
+// IF keyword condition
+// this is used to create condition block of code
+
+// the if needs a condition that the result is true and execute the
+// code inside of the if block
+
+const condition = 2 % 2 === 0;
+
+if (condition) {
+ // run this code
+ console.log("YEAH THIS RUN BECAUSE THE CONDITION IS A HARDCODE true");
+}
+
+// have a default value if the condition is false
+// this runs in the else code block
+
+if (condition) {
+ // this block of code is never executed
+} else {
+ // run this code
+ console.log("YEAH THIS RUN BECAUSE THE CONDITION IS A HARDCODE false");
+}
+
+// and you can make more conditions with an ELSE IF keyword
+
+if (!condition) {
+ // this block of code is never executed
+} else if (condition) {
+ // this code is executed because 1 is true like binary
+} else {
+ // this block of code is never executed
+}```
\ No newline at end of file
diff --git a/JavaScript_Basics/iife.js b/docs/JavaScript_Basics/iife.md
similarity index 64%
rename from JavaScript_Basics/iife.js
rename to docs/JavaScript_Basics/iife.md
index d9a87b6..8d57c00 100644
--- a/JavaScript_Basics/iife.js
+++ b/docs/JavaScript_Basics/iife.md
@@ -1,3 +1,4 @@
+```js
/*
IIFE: Immediately Invoked Function Expression or Anonymous functions
@@ -6,7 +7,7 @@ Functions that are invoked immediately after definition.
Can be used as shown below:--
*/
-(function(value){
- var modified = value + 4
- console.log(modified);
-}(3))
+(function (value) {
+ const modified = value + 4;
+ console.log(modified);
+}(3));```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/includes.md b/docs/JavaScript_Basics/includes.md
new file mode 100644
index 0000000..daf0775
--- /dev/null
+++ b/docs/JavaScript_Basics/includes.md
@@ -0,0 +1,9 @@
+```js
+// Find substring in a string. Similar to contains in java.
+
+// Defining dummy variables
+var string = "foo", substring1 = "oo", substring2="a";
+
+console.log(string.includes(substring1)); // true
+console.log(string.includes(substring2)); // false
+```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/inheritance.md b/docs/JavaScript_Basics/inheritance.md
deleted file mode 100644
index 1384947..0000000
--- a/docs/JavaScript_Basics/inheritance.md
+++ /dev/null
@@ -1 +0,0 @@
-# Inheritance
diff --git a/docs/JavaScript_Basics/looping-an-object.md b/docs/JavaScript_Basics/looping-an-object.md
deleted file mode 100644
index 18a6886..0000000
--- a/docs/JavaScript_Basics/looping-an-object.md
+++ /dev/null
@@ -1 +0,0 @@
-# Looping an object
\ No newline at end of file
diff --git a/JavaScript_Basics/looping-an-object.js b/docs/JavaScript_Basics/looping_an_object.md
similarity index 97%
rename from JavaScript_Basics/looping-an-object.js
rename to docs/JavaScript_Basics/looping_an_object.md
index 6838652..5fbcf77 100644
--- a/JavaScript_Basics/looping-an-object.js
+++ b/docs/JavaScript_Basics/looping_an_object.md
@@ -1,3 +1,4 @@
+```js
// Let's create a student object which contains their Roll. No and their names.
const studentObject = {
101: "Hitesh",
@@ -12,4 +13,4 @@ for (const key in studentObject) {
if (key === 105) {
console.log("The Student's name is ", studentObject[key]);
}
-}
\ No newline at end of file
+}```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/map.md b/docs/JavaScript_Basics/map.md
index 609b1a7..9e8f8cb 100644
--- a/docs/JavaScript_Basics/map.md
+++ b/docs/JavaScript_Basics/map.md
@@ -1,33 +1,17 @@
-# Array.prototype.map()
-
-We can use `map()` when we want to manipulate each data inside an array without changing the values of the original array.
-
-The `map()` method creates a new array with the results of calling the provided function for each element in the array.
-
-**Note:** `map()` does not execute the function if the array has no values.
-
-**Note:** this method does not change the original array.
-
-## Example
-
-The following code takes an array of numbers and creates a new array containing the square roots of the numbers in the first array.
-
-Using a callback function
```js
-var numbers = [1, 4, 9];
-var roots = numbers.map(function(num) {
- return Math.sqrt(num)
+// Let's create an array of numbers that we want to get the square of each number in the array
+const numbers = [1, 2, 3, 4, 5];
+
+// pass a function to map
+const square = numbers.map(function (num) {
+ return num * num;
});
-// roots is now [1, 2, 3]
-// numbers is still [1, 4, 9]
-```
+// You can also do this using an arrow function
+const square2 = numbers.map(num => num * num);
-Using an arrow function
-```js
-var numbers = [1, 4, 9];
-var roots = numbers.map(num => Math.sqrt(num));
+console.log(square);
+// expected output: Array [1, 4, 9, 16, 25]
-// roots is now [1, 2, 3]
-// numbers is still [1, 4, 9]
-```
\ No newline at end of file
+console.log(square2);
+// expected output: Array [1, 4, 9, 16, 25]```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/math.md b/docs/JavaScript_Basics/math.md
new file mode 100644
index 0000000..278351a
--- /dev/null
+++ b/docs/JavaScript_Basics/math.md
@@ -0,0 +1,53 @@
+```js
+// Math functions
+
+// ceil and floor functions
+Math.ceil(2.3); // will return 3
+Math.floor(3.9); // will return 3
+
+// sin and cos functions
+Math.sin(20 * Math.PI / 180); // will return 0.5 (the sine of 30 degrees)
+Math.cos(30 * Math.PI / 180); // will return 0.5 (the cos of 60 degrees)
+
+// min and max functions
+Math.min(50, 50, 810, 2200, -900); // will return -900
+Math.max(230, 250, 10, 300, -900); // will return 300
+
+// round function
+Math.round(5.899);
+
+// returns a random number that is not an integer between 1 to 10.
+Math.random() * (10 - 1) + 1;
+
+// Defining variables to carry out the mathematical functions on.
+value1 = 10;
+value2 = -20;
+value3 = 15.7;
+value4 = 40;
+value5 = 3;
+
+// This is a javacript document, wrote to outline the use of the math functions - inbuilt javascript functions used for carrying out maths!
+function round (value) {
+ console.log("The round function has been called, what this does is perform the javascript math.round on a value.");
+ return Math.round(value);
+}
+
+function pow (value1, value2) {
+ console.log("The power - pow() function, takes one number and calculates the power of the number off a second inputted value.");
+ return Math.round(value1, value2);
+}
+
+function sqrt (value) {
+ console.log("The Math.sqrt() calculates the square root of a number entered.");
+ return Math.sqrt(value);
+}
+
+function abs (value) {
+ console.log("The Math.abs() returns the absolute value of a number.");
+ return Math.abs(value);
+}
+
+console.log(round(value3));
+console.log(pow(value4, value5));
+console.log(sqrt(value5));
+console.log(abs(99.99));```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/number_methods.md b/docs/JavaScript_Basics/number_methods.md
new file mode 100644
index 0000000..c64c516
--- /dev/null
+++ b/docs/JavaScript_Basics/number_methods.md
@@ -0,0 +1,153 @@
+```js
+// isFinite()
+
+/*
+Checks whether a value is a finite number.
+Finite is a number that isn't infinite and can be measured or given a value.
+
+It only takes a single parameter which is the value you'd like to check.
+It's return value will be a boolean (true or false)
+
+Numbers that pass as finite:
+0
+whole numbers
+negative numbers
+decimals
+equations
+
+*/
+
+console.log(Number.isFinite(80)); // output = true
+console.log(Number.isFinite(-1.80)); // output = true
+console.log(Number.isFinite(2 * 2)); // output = true
+console.log(Number.isFinite(80)); // output = true
+console.log(Number.isFinite(0)); // output = true
+console.log(Number.isFinite("10/17/2019")); // output = false
+console.log(Number.isFinite("3")); // output = false
+
+// isInteger()
+
+/*
+Checks whether the value passed is an integer.
+It's return value will be a boolean (true / false)
+*/
+console.log(Number.isInteger(2)); // output = true
+console.log(Number.isInteger(-10)); // output = true
+console.log(Number.isInteger(2.50)); // output = false
+console.log(Number.isInteger(0)); // output = true
+
+// isNaN()
+
+/*
+Checks whether the value passed is NaN (Not a number) or if the value is a number
+true = NaN
+false = A number
+*/
+
+console.log(Number.isNaN(436)); // output = false
+console.log(Number.isNaN(91.9)); // output = false
+console.log(Number.isNaN("76")); // output = false
+console.log(Number.isNaN(true)); // output = false
+console.log(Number.isNaN(NaN)); // output = true
+console.log(Number.isNaN("NaN")); // output = false
+
+// isSafeInteger()
+
+/*
+Checks whether the method passed is a safe integer. The returned value will provide a boolean.
+
+A safe integer is represented as an IEEE-754 double precision number. This is simply any number between -9007199254740991 and 9007199254740991.
+
+Note that the value isn't changed to a number if a string is passed in.
+*/
+
+Number.isSafeInteger(9); // true
+Number.isSafeInteger(-234); // true
+Number.isSafeInteger("234"); // false
+Number.isSafeInteger(0.7); // true
+Number.isSafeInteger(2.0); // true
+
+// toExponential()
+
+/*
+Converts a number to its exponential form. The returned value is a string that represents the Number object in exponential notation
+*/
+
+const num1 = 89.0;
+num.toExponential(); // '"8.9e+1"
+
+const num2 = 2.5692;
+num.toExponential(); // "2.5691e+0"
+
+const num3 = -100.45;
+num.toExponential(); // "-1.0045e+2"
+
+// toFixed()
+
+/*
+Formats a number using the fixed-point notation. It allows you to format a number with a specific number of digits to the right of the decimal. Numbers will be rounded is ncessary.
+
+Its return value is a string with the given number using fixed-point notation. If the number given is negative, the return value will be a number and won't be converted into a string.
+*/
+
+3.45.toFixed(); // '"3"
+3.45.toFixed(1); // "3.5"
+48573.120.toFixed(5); // "48573.12000"
+3.45.toFixed() - // "3"
+ 180.45.toFixed(); // -100
+
+// toLocaleString()
+
+/*
+Converts a number into a language-sensitive representation of said number.
+It can take in two optional parameters:
+- locales: A string with a language tag (bali, latn)
+- options: A set of options for the given locale (curency, style)
+
+The return value is a string.
+*/
+
+let number = 8000;
+number.toLocaleString(); // "8,000" because the locale is English
+
+number = 800;
+number.toLocaleString("ja-JP", { style: "currency", currency: "JPY" }); // "¥800" because we set the the locale and options
+
+// toPrecision()
+
+/*
+Converts a number to the specified precision.
+
+The returned value is in the form of a string. The value will be rounded and padded with 0's if there are not enough digits.
+*/
+
+const precisionNum = 9.473739;
+
+console.log(precisionNum.toPrecision()); // "9.473739"
+console.log(precisionNum.toPrecision(4)); // "9.474"
+console.log(precisionNum.toPrecision(1)); // "9"
+
+// toString()
+
+/*
+Converts a given number to a string with the specified base number (an integer betwen 2 and 36)
+
+The return value is given in the form of a string if no radix is given.
+
+*/
+
+const toStringNum = 100;
+toStringNum.toString(2); // "1100100"
+toStringNum.toString(); // "100"
+toStringNum.toString(4); // "1210"
+
+// valueOf()
+
+/*
+Returns the number value in primitive form of a Number object.
+This is rarely something done on your own, as JavaScript invokes this automatically.
+*/
+
+const age = new Number(45);
+typeof age; // object
+age.valueOf(); // 45```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/objects.md b/docs/JavaScript_Basics/objects.md
index 2e79c08..69d9969 100644
--- a/docs/JavaScript_Basics/objects.md
+++ b/docs/JavaScript_Basics/objects.md
@@ -1 +1,62 @@
-# Objects
+```js
+// Object in basically collection of key value pairs
+const old = {
+ name: "Swapnil", // left is key and right one is value
+ rollno: 76 // We assign any type to keys
+};
+
+console.log(old);
+// Output { name: 'Swapnil', rollno: 76 }
+
+const a = {
+ name: "Swapnil", // We can omit the " " in keys but for string values it is necessary
+ rollno: 76 // We assign any type to keys
+};
+
+console.log(a);
+// Output { name: 'Swapnil', rollno: 76 }
+
+const b = {
+ name: "Swapnil",
+ rollno: 76,
+ rollno: "Swap" // If we repeat the same key then the latest value is stored
+};
+
+console.log(b);
+// Output { name: 'Swapnil', rollno: 'Swap' }
+
+console.log(a.name); // This way we can get a particular value for a key. " " around are imp.
+
+console.log(a.name); // This way you can get the value of particular element
+// Output Swapnil
+a.name = "Swapnil Satish Shinde"; // This way we can change a particular property of object
+
+console.log(a.name); // This way you can get the value of particular element
+// Output Swapnil Satish Shinde
+
+console.log(a);
+// Output { name: 'Swapnil Satish Shinde', rollno: 76 }
+
+const objectWithFunction = {
+ name: "Swapnil", // We can omit the " " in keys but for string values it is necessary
+ rollno: 76, // We assign any type to keys
+ getfull: function () { // Don't use arrow function here as arrow functions don't have this property
+ console.log(`${this.name} ${this.rollno}`);
+ }
+};
+
+console.log(objectWithFunction);
+// Output { name: 'Swapnil', rollno: 76, getfull: [Function: getfull] }
+
+objectWithFunction.getfull(); // Output Swapnil 76
+
+const canAddValue = { // This is normal object having 2 keys name and rollno
+ name: "Swapnil",
+ rollno: 76
+};
+
+// We can add the keys we want any time into the object by directly assigning value to it
+canAddValue.branch = "Computer";
+
+console.log(canAddValue);
+// Output { name: 'Swapnil', rollno: 76, branch: 'Computer' }```
\ No newline at end of file
diff --git a/docs/JavaScript_Basics/page-redirect.md b/docs/JavaScript_Basics/page-redirect.md
deleted file mode 100644
index 0161723..0000000
--- a/docs/JavaScript_Basics/page-redirect.md
+++ /dev/null
@@ -1,50 +0,0 @@
-### `Page Redirection and Auto Refresh`
-
-- ***Use:***
-Syntax: `Window.location ` [MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/location) takes parameters as `location = 'http://www.example.com'`
-
-
-Example of how to use page redirect.
-```html
-
-
-
-
-
-
-
Click the following button, you will be redirected to home page.
-
-
-
-
-
-```
-An example of how to perform an Auto Refresh
-```html
-
-
-
-
-
-
-
-
-