+
+
+
\ No newline at end of file
diff --git a/one.js b/one.js
new file mode 100644
index 0000000..f311c63
--- /dev/null
+++ b/one.js
@@ -0,0 +1,22 @@
+for (let i = 0; i < 10; i++) {
+ const element = i;
+ //console.log(element);
+
+}
+for (let i = 0; i <=10 ; i++) {
+ // console.log(`Outer loop value:${i}`);
+
+ for (let j = 0; j <= 10 ; j++) {
+ // console.log(i +'*'+ j + '=' +i*j);
+
+ }
+
+}
+
+let myArray = ["flash", "batman","superman"]
+for (let index = 0; index < myArray.length; index++) {
+ const element = myArray[index];
+ //console.log(element);
+
+}
+
diff --git a/oop.js b/oop.js
new file mode 100644
index 0000000..e4d8b72
--- /dev/null
+++ b/oop.js
@@ -0,0 +1,35 @@
+// const user = {
+// username:"Gauri",
+// loginCount:8,
+// signedIn:true,
+// getUserDetails: function(){
+// //console.log("Got user details from database");
+// //console.log(`username ${this.username}`);
+// }
+
+// }
+//console.log(user.username);
+//console.log(user.getUserDetails());
+
+//const promise = new Promise()
+//const date = new Date()
+
+function User(username,loginCount,isLoggedIn){
+ this.username = username;
+ this.loginCount = loginCount;
+ this.isLoggedIn = isLoggedIn;
+
+ this.greeting = function(){
+ console.log(`welcome ${this.username}`);
+ }
+
+ //return this
+}
+
+const userOne = new User("Gauri",12,true)
+const userTwo = new User("Js",20,true)
+console.log(userOne);
+//new keyword creates an new object
+//after new keyword a constructor function is called
+//arguments inject in this keyword
+
diff --git a/promise.js b/promise.js
new file mode 100644
index 0000000..993d821
--- /dev/null
+++ b/promise.js
@@ -0,0 +1,83 @@
+const promiseOne = new Promise(function(resolve, reject){
+ //Do an async task
+ //DB calls,cryptography,network
+ setTimeout(function() {
+ console.log('async task is complete');
+ resolve()
+ }, 1000);
+})
+promiseOne.then(function(){
+ console.log('promise consumed');
+})
+
+new Promise(function(resolve,reject){
+ setTimeout(function(){
+ console.log("Async task two");
+ resolve()
+ })
+}).then(function(){
+ console.log("Async two resolved");
+})
+
+const promiseThree = new Promise(function(resolve,reject){
+ setTimeout(function(){
+ resolve({username:"chai" , email:'chai@example.com'})
+ },1000)
+})
+promiseThree.then(function (user) {
+ console.log(user);
+})
+
+promiseFour = new Promise(function(resolve,reject){
+ setTimeout(function(){
+ let error = true
+ if(!error){
+ resolve({username: "Gauri", password: "123"})
+ }else{
+ reject('Error:Something went wrong')
+ }
+ },1000)
+})
+promiseFour
+.then((user)=>{
+ console.log(user);
+ return user.username
+})
+.then((username) =>{
+ console.log(username);
+} )
+.catch(function(error){
+ console.log(error);
+})
+.finally(()=> console.log("The promise is either resolved or rejected"));
+
+
+const promiseFive = new Promise(function(resolve,reject){
+ setTimeout(function(){
+ let error = true
+ if(!error){
+ resolve({username: "Javascript", password: "123"})
+ }else{
+ reject('Error:JS went wrong')
+ }
+ },1000)
+})
+
+async function consumePromiseFive(){
+ try {
+ const response = await promiseFive
+ console.log(promiseFive);
+ } catch (error) {
+ console.log(error);
+ }
+}
+consumePromiseFive()
+
+fetch('https://api.github.com/users/gaurisonawane07')
+.then((response)=>{
+ return response.json()
+})
+.then((data)=>{
+ console.log(data);
+})
+.catch((error) => console.log(error));
\ No newline at end of file
diff --git a/prototype.js b/prototype.js
new file mode 100644
index 0000000..aaffe87
--- /dev/null
+++ b/prototype.js
@@ -0,0 +1,52 @@
+// let myName = "Gauri "
+// console.log(myName.truelength);
+
+let myHeroes = ["thor","spiderman"]
+let heroPower = {
+ thor:"Hammer",
+ spiderman:"sling",
+ getSpiderPower: function(){
+ // console.log(`Spider powes is ${this.spiderman}`);
+ }
+}
+
+Object.prototype.gauri = function(){
+ // console.log(`gauri is present in all objects`);
+}
+
+Array.prototype.heyGauri = function(){
+ // console.log(`Gauri says hello`);
+}
+// myHeroes.gauri()
+// myHeroes.heyGauri()
+
+//heroPower.gauri()
+
+//****************************INHERITANCE*********************************/
+const User ={
+ name:"chai",
+ email:"hbgdsdx@google.com"
+}
+const Teacher = {
+ makeVideo :true
+}
+const teachingSupport = {
+ isAvailable: false
+}
+const TASupport = {
+ makeAssignment: "JS assignment",
+ fullTime: true,
+ __proto__:teachingSupport
+}
+Teacher.__proto__ = User
+
+//modern syntax
+Object.setPrototypeOf(teachingSupport,Teacher)
+
+let anotherUserName = "chaiAurCode "
+
+String.prototype.trueLength = function(){
+ console.log(`${this}`);
+ console.log(`true length is ${this.trim().length}`);
+}
+anotherUserName.trueLength()
\ No newline at end of file
diff --git a/seven.js b/seven.js
new file mode 100644
index 0000000..bbfb10e
--- /dev/null
+++ b/seven.js
@@ -0,0 +1,7 @@
+//reduce
+const myNums = [1,2,3]
+const myTotal = myNums.reduce(function(acc,curVal){
+ console.log(`accumulator is ${acc} + current value is ${curVal}`);
+ return acc + curVal
+},0)
+console.log(myTotal);
\ No newline at end of file
diff --git a/six.js b/six.js
new file mode 100644
index 0000000..0d4526b
--- /dev/null
+++ b/six.js
@@ -0,0 +1,9 @@
+//map
+const myNums = [1,2,3,4,5,6,7,8,9,0]
+
+//const newNums = myNums.map((num)=> num+10)
+//console.log(newNums);
+const newNums = myNums
+ .map((num)=>num*10)
+ .map((num)=> num+1)
+console.log(newNums);
diff --git a/switch.js b/switch.js
new file mode 100644
index 0000000..f9a24f4
--- /dev/null
+++ b/switch.js
@@ -0,0 +1,24 @@
+// switch (key) {
+// case value:
+
+// break;
+
+// default:
+// break;
+// }
+const month = 3
+switch (month) {
+ case 1:
+ console.log("january");
+ break;
+ case 2:
+ console.log("Feb");
+ break;
+ case 3:
+ console.log("March");
+ break;
+
+ default:
+ console.log("default case match");
+ break;
+}
\ No newline at end of file
diff --git a/three.html b/three.html
new file mode 100644
index 0000000..aee5344
--- /dev/null
+++ b/three.html
@@ -0,0 +1,21 @@
+
+
+
+
+
+ Document
+
+
+
Chai aur JAVASCRIPT
+
+
+
+
+
+
\ No newline at end of file
diff --git a/three.js b/three.js
new file mode 100644
index 0000000..72156e5
--- /dev/null
+++ b/three.js
@@ -0,0 +1,23 @@
+//for of loop
+
+const arr = [1,2,3,4,5]
+
+for (const num of arr) {
+ console.log(num);
+}
+
+const greeting = "Hello World!"
+for (const greet of greeting) {
+ console.log(`Each char is ${greet}`);
+
+}
+
+//Maps
+const map = new Map()
+map.set('IN',"INDIA")
+map.set('USA',"UNITED STATES OF AMERICA")
+map.set('FR',"FRANCE")
+console.log(map);
+for (const [key,value] of map) {
+ console.log(key,"->",value);
+}
\ No newline at end of file
diff --git a/truthy.js b/truthy.js
new file mode 100644
index 0000000..11c9488
--- /dev/null
+++ b/truthy.js
@@ -0,0 +1,21 @@
+//falsy values
+//false,0,-0,BigInt 0n,"",null,undefined,NaN
+
+//truthy values
+//"0",'false'," ",[],{},function(){}
+const userEmail = "gauri@03";
+if(userEmail.length === 0){
+ console.log("Array is empty");
+}
+
+//nullish coalscing Operator(??):null undefined
+let val1;
+val1 = 5 ?? 10
+console.log(val1);
+let val2 = null ?? 10;
+console.log(val2);
+
+//terniary operator
+
+const iceTeaPrice = 100
+iceTeaPrice>= 80 ? console.log("Less Than 80"):console.log("More then 80");
\ No newline at end of file
diff --git a/two.html b/two.html
new file mode 100644
index 0000000..1803e02
--- /dev/null
+++ b/two.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+ Document
+
+
+
Chai aur code
+
+
+
+
+
\ No newline at end of file
diff --git a/two.js b/two.js
new file mode 100644
index 0000000..b93f58e
--- /dev/null
+++ b/two.js
@@ -0,0 +1,13 @@
+let index = 0
+
+while (index <= 10) {
+ console.log(`value of index is ${index}`);
+ index = index + 2
+}
+
+
+let score = 11
+do {
+ console.log(`Score is ${score}`);
+
+} while (score<=10);