From 53bdacdd59051f06ab3486d69c39375f943160bd Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 16:13:51 +0530 Subject: [PATCH 1/6] level 1 complete --- solutions/day-01/level1.js | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 solutions/day-01/level1.js diff --git a/solutions/day-01/level1.js b/solutions/day-01/level1.js new file mode 100644 index 0000000..e69de29 From e120f12098281d1b717cfd93410030d98b967c90 Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 19:15:57 +0530 Subject: [PATCH 2/6] level1 complete --- solutions/day-01/level1.js | 102 +++++++++++++++++++++++++++++++++++++ 1 file changed, 102 insertions(+) diff --git a/solutions/day-01/level1.js b/solutions/day-01/level1.js index e69de29..6654b41 100644 --- a/solutions/day-01/level1.js +++ b/solutions/day-01/level1.js @@ -0,0 +1,102 @@ +const countries = [ + 'Albania', + 'Bolivia', + 'Canada', + 'Denmark', + 'Ethiopia', + 'Finland', + 'Germany', + 'Hungary', + 'Ireland', + 'Japan', + 'Kenya', + ] + + const webTechs = [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Redux', + 'Node', + 'MongoDB', + ] + let arr1 = [] + let arr2 = [10,20,30,40,50,60,70] + console.log(arr2.length) + console.log(arr2[0]) + console.log(arr2[Math.floor((arr2.length-1)/2)]) + console.log(arr2[arr2.length-1]) + + let mixedDataTypes = [1,"Ashim",['Apple','Mango','Jackfruit'],true,3.14,333] + console.log(mixedDataTypes.length) + + let itCompanies = ["Facebook", "Google" , "Microsoft" , "Apple" , "IBM" , "Oracle", "Amazon", "Jio"] + console.log(itCompanies) + console.log("there are " + itCompanies.length + " IT Companies") + console.log("The first company is "+ itCompanies[0]) + console.log("The last company is "+ itCompanies[itCompanies.length-1]) + console.log("The middle company is "+ itCompanies[Math.floor((itCompanies.length-1)/2)]) + console.log("All the IT companies are :"+ itCompanies.join(", ")) + console.log(itCompanies[0].toUpperCase()) + console.log(itCompanies[1].toUpperCase()) + console.log(itCompanies[2].toUpperCase()) + console.log(itCompanies[3].toUpperCase()) + console.log(itCompanies[4].toUpperCase()) + console.log(itCompanies[5].toUpperCase()) +console.log(itCompanies.toString()) + +let index = itCompanies.includes("Apples") + +if(index){ + console.log("The Item exists in the array") +}else{ + console.log("The Item does not exist") +} +let reqComp = []; +for(let i = 0 ; i < itCompanies.length ; i++){ + if(itCompanies[i].includes('o')){ + let company = itCompanies[i].toLowerCase().split('') + //console.log(company) + let count = 0; + for(let j = 0 ; j < company.length ; j++){ + if(company[j] == 'o'){ + count += 1; + } + } + if(count > 1){ + reqComp.push(itCompanies[i]) + } + } +} +//console.log(reqComp) + +//console.log(itCompanies.sort()) +//console.log(itCompanies.reverse()) + +//onsole.log(itCompanies.slice(0,3)) +//console.log(itCompanies.splice(4,)) +let length = itCompanies.length +// let lower = Math.floor((length-1)/2) +// let upper = Math.ceil((length-1)/2) +// console.log(lower) +// console.log(upper) +// console.log(itCompanies.slice(lower , upper+1)) + +// itCompanies.splice(0,1) +// console.log(itCompanies) + +//let floorMid = Math.floor((length-1)/2) +// let ceilMid = Math.ceil((length-1)/2) +// if(length%2 == 0){ +// itCompanies.splice(floorMid,2) +// }else{ +// itCompanies.splice(floorMid,1) +// } +// console.log(itCompanies) + +// itCompanies.splice(itCompanies.length-1,1) +// console.log(itCompanies) + +itCompanies.splice(0) +console.log(itCompanies) \ No newline at end of file From 8e7ba6534ab58be9ac7ecc4028d1b36e96c2d02e Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 19:18:04 +0530 Subject: [PATCH 3/6] update --- solutions/day-01/level1.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/solutions/day-01/level1.js b/solutions/day-01/level1.js index 6654b41..81e0dc3 100644 --- a/solutions/day-01/level1.js +++ b/solutions/day-01/level1.js @@ -98,5 +98,5 @@ let length = itCompanies.length // itCompanies.splice(itCompanies.length-1,1) // console.log(itCompanies) -itCompanies.splice(0) -console.log(itCompanies) \ No newline at end of file +// itCompanies.splice(0) +// console.log(itCompanies) \ No newline at end of file From cbfec32c3d225393cd0fbd619914dc40bd07443e Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 19:21:55 +0530 Subject: [PATCH 4/6] update --- solutions/day-01/level1.js | 70 +++++++++++++------------------------- 1 file changed, 24 insertions(+), 46 deletions(-) diff --git a/solutions/day-01/level1.js b/solutions/day-01/level1.js index 81e0dc3..3898168 100644 --- a/solutions/day-01/level1.js +++ b/solutions/day-01/level1.js @@ -1,26 +1,4 @@ -const countries = [ - 'Albania', - 'Bolivia', - 'Canada', - 'Denmark', - 'Ethiopia', - 'Finland', - 'Germany', - 'Hungary', - 'Ireland', - 'Japan', - 'Kenya', - ] - - const webTechs = [ - 'HTML', - 'CSS', - 'JavaScript', - 'React', - 'Redux', - 'Node', - 'MongoDB', - ] + let arr1 = [] let arr2 = [10,20,30,40,50,60,70] console.log(arr2.length) @@ -69,34 +47,34 @@ for(let i = 0 ; i < itCompanies.length ; i++){ } } } -//console.log(reqComp) +console.log(reqComp) -//console.log(itCompanies.sort()) -//console.log(itCompanies.reverse()) +console.log(itCompanies.sort()) +console.log(itCompanies.reverse()) -//onsole.log(itCompanies.slice(0,3)) +onsole.log(itCompanies.slice(0,3)) //console.log(itCompanies.splice(4,)) let length = itCompanies.length -// let lower = Math.floor((length-1)/2) -// let upper = Math.ceil((length-1)/2) -// console.log(lower) -// console.log(upper) -// console.log(itCompanies.slice(lower , upper+1)) +let lower = Math.floor((length-1)/2) +let upper = Math.ceil((length-1)/2) +console.log(lower) +console.log(upper) +console.log(itCompanies.slice(lower , upper+1)) -// itCompanies.splice(0,1) -// console.log(itCompanies) +itCompanies.splice(0,1) +console.log(itCompanies) -//let floorMid = Math.floor((length-1)/2) -// let ceilMid = Math.ceil((length-1)/2) -// if(length%2 == 0){ -// itCompanies.splice(floorMid,2) -// }else{ -// itCompanies.splice(floorMid,1) -// } -// console.log(itCompanies) +let floorMid = Math.floor((length-1)/2) +let ceilMid = Math.ceil((length-1)/2) +if(length%2 == 0){ + itCompanies.splice(floorMid,2) +}else{ + itCompanies.splice(floorMid,1) +} +console.log(itCompanies) -// itCompanies.splice(itCompanies.length-1,1) -// console.log(itCompanies) +itCompanies.splice(itCompanies.length-1,1) +console.log(itCompanies) -// itCompanies.splice(0) -// console.log(itCompanies) \ No newline at end of file +itCompanies.splice(0) +console.log(itCompanies) \ No newline at end of file From 62acf96634b4d9481b60c38884da9106f2fe61a5 Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 19:22:18 +0530 Subject: [PATCH 5/6] update --- solutions/day-01/level1.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/solutions/day-01/level1.js b/solutions/day-01/level1.js index 3898168..ce463e4 100644 --- a/solutions/day-01/level1.js +++ b/solutions/day-01/level1.js @@ -1,5 +1,4 @@ - - let arr1 = [] +let arr1 = [] let arr2 = [10,20,30,40,50,60,70] console.log(arr2.length) console.log(arr2[0]) From 4f2d41d6f4022f0b5a667dfedb39bd8c1c9f326e Mon Sep 17 00:00:00 2001 From: Ashim Debnath Date: Wed, 5 Feb 2025 20:30:12 +0530 Subject: [PATCH 6/6] new files added --- solutions/day-01/countries.mjs | 14 ++++++++++ solutions/day-01/level2.mjs | 51 ++++++++++++++++++++++++++++++++++ solutions/day-01/level3.js | 0 solutions/day-01/web_techs.mjs | 10 +++++++ 4 files changed, 75 insertions(+) create mode 100644 solutions/day-01/countries.mjs create mode 100644 solutions/day-01/level2.mjs create mode 100644 solutions/day-01/level3.js create mode 100644 solutions/day-01/web_techs.mjs diff --git a/solutions/day-01/countries.mjs b/solutions/day-01/countries.mjs new file mode 100644 index 0000000..6e434fe --- /dev/null +++ b/solutions/day-01/countries.mjs @@ -0,0 +1,14 @@ +const countries = [ + 'Albania', + 'Bolivia', + 'Canada', + 'Denmark', + 'Ethiopia', + 'Finland', + 'Germany', + 'Hungary', + 'Ireland', + 'Japan', + 'Kenya', + ] + export default countries \ No newline at end of file diff --git a/solutions/day-01/level2.mjs b/solutions/day-01/level2.mjs new file mode 100644 index 0000000..c3f0cfe --- /dev/null +++ b/solutions/day-01/level2.mjs @@ -0,0 +1,51 @@ +import webTechs from "./web_techs.mjs"; +import countries from "./countries.mjs"; + +// console.log(webTechs) +// console.log(countries) + +let text = + 'I love teaching and empowering people. I teach HTML, CSS, JS, React, Python.' + + let words = text.split(" ") +console.log(words) +console.log(words.length) + +const shoppingCart = ['Milk', 'Coffee', 'Tea', 'Honey'] + +if(shoppingCart[0]!="Meat"){ + shoppingCart.unshift("Meat") +}console.log(shoppingCart) + +if(shoppingCart[shoppingCart.length-1]!="Sugar"){ + shoppingCart.push("Sugar") +}console.log(shoppingCart) + + +const Allergy = true + +if(Allergy==true){ + let i = shoppingCart.indexOf('Honey') + shoppingCart.splice(i,1) +}console.log(shoppingCart) + +let index = shoppingCart.indexOf('Tea') +shoppingCart[index] = 'Green Tea' +console.log(shoppingCart) + +if(countries.includes("Ethiopia")){ + console.log("ETHIOPIA") +}else{ + countries.push('Ethiopia') +} + +if(webTechs.includes('Sass')){ + console.log("sass is a css preprocessor") +}else{ + webTechs.push("Sass") +}console.log(webTechs) + +const frontEnd = ['HTML', 'CSS', 'JS', 'React', 'Redux'] +const backEnd = ['Node', 'Express', 'MongoDB'] +let fullStack = frontEnd.concat(backEnd) +console.log(fullStack) \ No newline at end of file diff --git a/solutions/day-01/level3.js b/solutions/day-01/level3.js new file mode 100644 index 0000000..e69de29 diff --git a/solutions/day-01/web_techs.mjs b/solutions/day-01/web_techs.mjs new file mode 100644 index 0000000..92d6ce6 --- /dev/null +++ b/solutions/day-01/web_techs.mjs @@ -0,0 +1,10 @@ +const webTechs = [ + 'HTML', + 'CSS', + 'JavaScript', + 'React', + 'Redux', + 'Node', + 'MongoDB', + ] + export default webTechs \ No newline at end of file