From 8f25237d83de6bdb22fa66623a11bf68a91d0ead Mon Sep 17 00:00:00 2001 From: zohir rayhan Date: Fri, 10 Jan 2020 16:08:51 +0200 Subject: [PATCH 1/9] Create the first file --- Week1/homework/js-exercices/logHello.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Week1/homework/js-exercices/logHello.js diff --git a/Week1/homework/js-exercices/logHello.js b/Week1/homework/js-exercices/logHello.js new file mode 100644 index 000000000..70eda7ad4 --- /dev/null +++ b/Week1/homework/js-exercices/logHello.js @@ -0,0 +1,11 @@ +'use strict' +console.log("Hello, world"); //English +console.log("Bonjour, tout le monde"); //French +console.log("Halo, dunia!"); // Indonesian +console.log("Ciao, mondo!"); // Italian +console.log("Hola, mundo!"); // Spanish +console.log("Hallo Welt"); //Deuch +console.log("Hej Verden"); //Danois +console.log("Γειά σου Κόσμε"); //Greek +console.log("Helo Byd"); //Gallois +console.log("Dia duit, domhan"); //Irlandais \ No newline at end of file From e70ec9936f62db07298dc5770a33e7383ca097c0 Mon Sep 17 00:00:00 2001 From: zohir rayhan Date: Fri, 10 Jan 2020 16:59:09 +0200 Subject: [PATCH 2/9] Ajout de dossier --- Week1/homework/js-exercices/logHello.js | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 Week1/homework/js-exercices/logHello.js diff --git a/Week1/homework/js-exercices/logHello.js b/Week1/homework/js-exercices/logHello.js new file mode 100644 index 000000000..70eda7ad4 --- /dev/null +++ b/Week1/homework/js-exercices/logHello.js @@ -0,0 +1,11 @@ +'use strict' +console.log("Hello, world"); //English +console.log("Bonjour, tout le monde"); //French +console.log("Halo, dunia!"); // Indonesian +console.log("Ciao, mondo!"); // Italian +console.log("Hola, mundo!"); // Spanish +console.log("Hallo Welt"); //Deuch +console.log("Hej Verden"); //Danois +console.log("Γειά σου Κόσμε"); //Greek +console.log("Helo Byd"); //Gallois +console.log("Dia duit, domhan"); //Irlandais \ No newline at end of file From e6de426b0ccefba19d2545e2710a5a1db834b782 Mon Sep 17 00:00:00 2001 From: zohir rayhan Date: Fri, 10 Jan 2020 19:42:26 +0200 Subject: [PATCH 3/9] Add to the second file --- Week1/homework/js-exercices/debugError.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 Week1/homework/js-exercices/debugError.js diff --git a/Week1/homework/js-exercices/debugError.js b/Week1/homework/js-exercices/debugError.js new file mode 100644 index 000000000..4a76173c3 --- /dev/null +++ b/Week1/homework/js-exercices/debugError.js @@ -0,0 +1,2 @@ +'use strict' +console.log("I'm awesome"); \ No newline at end of file From 71d8f94806967c367d57da4d70687a2ac560da8f Mon Sep 17 00:00:00 2001 From: zohir rayhan Date: Fri, 10 Jan 2020 21:49:38 +0200 Subject: [PATCH 4/9] Add of all the exercices of the homework --- Week1/homework/js-exercices/animalTable.js | 21 ++++++++++++++++ Week1/homework/js-exercices/aroundNumber.js | 7 ++++++ Week1/homework/js-exercices/compareArray.js | 6 +++++ Week1/homework/js-exercices/lenghOfString.js | 3 +++ Week1/homework/js-exercices/logRemainder.js | 8 ++++++ Week1/homework/js-exercices/saveNumber.js | 7 ++++++ Week1/homework/js-exercices/saveString.js | 7 ++++++ Week1/homework/js-exercices/verifyType.js | 26 ++++++++++++++++++++ 8 files changed, 85 insertions(+) create mode 100644 Week1/homework/js-exercices/animalTable.js create mode 100644 Week1/homework/js-exercices/aroundNumber.js create mode 100644 Week1/homework/js-exercices/compareArray.js create mode 100644 Week1/homework/js-exercices/lenghOfString.js create mode 100644 Week1/homework/js-exercices/logRemainder.js create mode 100644 Week1/homework/js-exercices/saveNumber.js create mode 100644 Week1/homework/js-exercices/saveString.js create mode 100644 Week1/homework/js-exercices/verifyType.js diff --git a/Week1/homework/js-exercices/animalTable.js b/Week1/homework/js-exercices/animalTable.js new file mode 100644 index 000000000..3ffa63f2e --- /dev/null +++ b/Week1/homework/js-exercices/animalTable.js @@ -0,0 +1,21 @@ +'use strict' +let numbersTable=[]; +console.log("I create an empty table"); +numbersTable=[1, 3, 5, 7, 9]; +console.log("Numbers table:"); +let x; let i=0; +for (x of numbersTable) { + console.log(numbersTable[i]); i++; +} +let animalsTable=["Lion", "Cat", "Dogg"]; +console.log("\nAnimals table 1:"); +i=0; +for (x of animalsTable) { + console.log(animalsTable[i]); i++; +} +animalsTable.push("Porcelet"); +console.log("\nAnimals table 2:"); +i=0; +for (x of animalsTable) { + console.log(animalsTable[i]); i++; +} diff --git a/Week1/homework/js-exercices/aroundNumber.js b/Week1/homework/js-exercices/aroundNumber.js new file mode 100644 index 000000000..d0b73ac08 --- /dev/null +++ b/Week1/homework/js-exercices/aroundNumber.js @@ -0,0 +1,7 @@ +'use strict' +let z=7.25; +console.log("Declaration and initialisation the variable z: "+z); +let a=parseInt(z); +console.log("Declaration and initialisation the variable a: "+a); +let max=(z>a ? z : a); +console.log("The greatest value: "+max); diff --git a/Week1/homework/js-exercices/compareArray.js b/Week1/homework/js-exercices/compareArray.js new file mode 100644 index 000000000..12a62349b --- /dev/null +++ b/Week1/homework/js-exercices/compareArray.js @@ -0,0 +1,6 @@ +'use strict' +const array1 = [ "hello" , 123 , true , { name : "Noer" } ] , array2=["balde", "diallo", "sow", "barry"]; +console . log ( "the length of the table 1 is: " +array1.length +", the length of the table 2 is: "+array1.length) ; +if(array1.length==array2.length){ + console.log("They are the same!"); +}else{ console.log("Two different sizes");} \ No newline at end of file diff --git a/Week1/homework/js-exercices/lenghOfString.js b/Week1/homework/js-exercices/lenghOfString.js new file mode 100644 index 000000000..24e4e1c85 --- /dev/null +++ b/Week1/homework/js-exercices/lenghOfString.js @@ -0,0 +1,3 @@ +'use strict' +let mySentence="La programmation est tellement intéressante!"; +console.log("the lengh of my sentence is: "+mySentence.length); diff --git a/Week1/homework/js-exercices/logRemainder.js b/Week1/homework/js-exercices/logRemainder.js new file mode 100644 index 000000000..baba47af5 --- /dev/null +++ b/Week1/homework/js-exercices/logRemainder.js @@ -0,0 +1,8 @@ +'use strict' +let x=7, y= 21, z=13; +x = x % 3; y = y % 4; z = z % 2; +console.log("the remainde of x/3 is: "+x); +console.log("the remainde of y/4 is: "+y); +console.log("the remainde of z/2 is: "+z); + + diff --git a/Week1/homework/js-exercices/saveNumber.js b/Week1/homework/js-exercices/saveNumber.js new file mode 100644 index 000000000..83bbf1922 --- /dev/null +++ b/Week1/homework/js-exercices/saveNumber.js @@ -0,0 +1,7 @@ +'use strict' +let myNum; +console.log("Variable declaration"); +console.log("variable initialisation"); +myNum=19; +console.log("the variable type is :"+typeof(myNum)); +console.log("the variable value is :"+myNum); diff --git a/Week1/homework/js-exercices/saveString.js b/Week1/homework/js-exercices/saveString.js new file mode 100644 index 000000000..72578eed5 --- /dev/null +++ b/Week1/homework/js-exercices/saveString.js @@ -0,0 +1,7 @@ +'use strict' +let myString="Boubacar Balde"; +console.log("The variable is a string and containt my name"); +console.log("the variable value is :"+myString); +myString="My new string sentence"; +console.log("The variable containt a new string"); +console.log("the variable value is :"+myString); diff --git a/Week1/homework/js-exercices/verifyType.js b/Week1/homework/js-exercices/verifyType.js new file mode 100644 index 000000000..4b5c2909d --- /dev/null +++ b/Week1/homework/js-exercices/verifyType.js @@ -0,0 +1,26 @@ +'use strict' +let vari1="First variable", vari2="Second variable", vari3=null, vari4=null; +console.log("the variable 1 type is: "+typeof(vari1)+" the variable 2 type is : "+typeof(vari2)); +if(typeof(vari1)===typeof(vari2)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} +console.log("the variable 1 type is: "+typeof(vari1)+" the variable 3 type is : "+typeof(vari3)); +if(typeof(vari1)===typeof(vari3)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} +console.log("the variable 1 type is: "+typeof(vari1)+" the variable 4 type is : "+typeof(vari4)); +if(typeof(vari1)===typeof(vari4)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} +console.log("the variable 2 type is: "+typeof(vari2)+" the variable 3 type is : "+typeof(vari3)); +if(typeof(vari2)===typeof(vari3)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} +console.log("the variable 2 type is: "+typeof(vari2)+" the variable 4 type is : "+typeof(vari4)); +if(typeof(vari2)===typeof(vari4)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} +console.log("the variable 3 type is: "+typeof(vari3)+" the variable 4 type is : "+typeof(vari4)); +if(typeof(vari3)===typeof(vari4)){ + console.log('SAME TYPE'); +}else{console.log('NOT SAME TYPE');} From b9eb54fa222b8b540c40c9b884ae44735ae26898 Mon Sep 17 00:00:00 2001 From: abdo Date: Mon, 13 Jan 2020 20:30:12 +0200 Subject: [PATCH 5/9] Add the first file --- Week2/homework/js-execices/removeComma.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 Week2/homework/js-execices/removeComma.js diff --git a/Week2/homework/js-execices/removeComma.js b/Week2/homework/js-execices/removeComma.js new file mode 100644 index 000000000..43fa5d765 --- /dev/null +++ b/Week2/homework/js-execices/removeComma.js @@ -0,0 +1,6 @@ +'use strict' +let myString = "hello,this,is,a,difficult,to,read,sentence"; +console.log("my string in the first time: "+myString); +console.log("the length of my String is: "+myString.length); +myString = myString.replace(/,/g, " "); +console.log("my string in the second time: "+myString); From 2a17b4777c2f828c7cb1cf54f0f31a1be9e3e9d6 Mon Sep 17 00:00:00 2001 From: abdo Date: Thu, 16 Jan 2020 19:02:06 +0200 Subject: [PATCH 6/9] Add 3 files of homework --- Week2/homework/js-execices/readingList.js | 1 + Week2/homework/js-execices/recipeCard.js | 12 ++++++++++++ Week2/homework/js-execices/reportEvenOdd.js | 6 ++++++ 3 files changed, 19 insertions(+) create mode 100644 Week2/homework/js-execices/readingList.js create mode 100644 Week2/homework/js-execices/recipeCard.js create mode 100644 Week2/homework/js-execices/reportEvenOdd.js diff --git a/Week2/homework/js-execices/readingList.js b/Week2/homework/js-execices/readingList.js new file mode 100644 index 000000000..ccacec309 --- /dev/null +++ b/Week2/homework/js-execices/readingList.js @@ -0,0 +1 @@ +'use strict' diff --git a/Week2/homework/js-execices/recipeCard.js b/Week2/homework/js-execices/recipeCard.js new file mode 100644 index 000000000..8f9bd1616 --- /dev/null +++ b/Week2/homework/js-execices/recipeCard.js @@ -0,0 +1,12 @@ +'use strict' +var maRecette={ + name: "Omelete", + serves: 2, + ingredients: ["4 eggs", "2 strips of bacon", "tsp salt/pepper" ] +} +console.log("My meal name is: " +maRecette.name+" \nServes : "+maRecette.serves); +let ingr="Ingredients :\n" +for(var x of maRecette.ingredients ){ + ingr+=x+"\n"; +} +console.log(ingr); \ No newline at end of file diff --git a/Week2/homework/js-execices/reportEvenOdd.js b/Week2/homework/js-execices/reportEvenOdd.js new file mode 100644 index 000000000..3620088e1 --- /dev/null +++ b/Week2/homework/js-execices/reportEvenOdd.js @@ -0,0 +1,6 @@ +'use strict' +for(let x=1; x<=20; x++){ + if((x % 2) ==0){ + console.log("The number: "+x+" is odd!"); + }else{console.log("The number: "+x+" is even!");} +} From f5a2999546220531ecc1d422d62a1d51eea10ede Mon Sep 17 00:00:00 2001 From: abdo Date: Fri, 17 Jan 2020 21:02:22 +0200 Subject: [PATCH 7/9] Add the fourth file --- Week2/homework/js-execices/readingList.js | 24 +++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/Week2/homework/js-execices/readingList.js b/Week2/homework/js-execices/readingList.js index ccacec309..b72dd6e92 100644 --- a/Week2/homework/js-execices/readingList.js +++ b/Week2/homework/js-execices/readingList.js @@ -1 +1,25 @@ 'use strict' +var mesLivres=[ + { + title:"Les Crapauds-brousse", + author:"Tierno Monénembo", + alreadyRead:true, + }, + { + title: "La Révolte des bovidés", + author: "Amadou Hampâté Bâ", + alreadyRead: true, + }, + { + title: "Hosties noires", + author: "Léopold Sédar Senghor", + alreadyRead: false, + } + +] +for (let livreX of mesLivres ) { + console.log(livreX.title+" of "+livreX.author) + if(livreX.alreadyRead){ + console.log("You already read : "+livreX.title+"\n") + }else{ console.log("You still need to read : "+livreX.title+"\n")} +} From 2b27bce054978b3d73ef00a279d05b636da43562 Mon Sep 17 00:00:00 2001 From: abdo Date: Fri, 17 Jan 2020 21:59:33 +0200 Subject: [PATCH 8/9] End of Homework 2 --- Week2/homework/js-execices/wantsDrink.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Week2/homework/js-execices/wantsDrink.js diff --git a/Week2/homework/js-execices/wantsDrink.js b/Week2/homework/js-execices/wantsDrink.js new file mode 100644 index 000000000..30f7ce0aa --- /dev/null +++ b/Week2/homework/js-execices/wantsDrink.js @@ -0,0 +1,17 @@ +'use strict' +let drinkTray = []; +const drinkTypes = [ "cola" , "limonade" , "eau" ]; +let y=1 ; +drinkTypes.forEach(function(element){ + let x=1; + do{ + drinkTray.push(element); x++; y++; + }while((x<=2) && (y<5)); +}); +let drinkGay="Hey guys, I brought a "; y=1; +drinkTray.forEach(function(element){ + if (y Date: Fri, 24 Jan 2020 17:40:04 +0200 Subject: [PATCH 9/9] Done the homework week3 --- Week3/homework/js-execices/dogYears.js | 7 +++++++ Week3/homework/js-execices/fortuneTeller.js | 9 +++++++++ Week3/homework/js-execices/giveComplim.js | 8 ++++++++ Week3/homework/js-execices/shopMarket.js | 13 +++++++++++++ Week3/homework/js-execices/totalCost.js | 17 +++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 Week3/homework/js-execices/dogYears.js create mode 100644 Week3/homework/js-execices/fortuneTeller.js create mode 100644 Week3/homework/js-execices/giveComplim.js create mode 100644 Week3/homework/js-execices/shopMarket.js create mode 100644 Week3/homework/js-execices/totalCost.js diff --git a/Week3/homework/js-execices/dogYears.js b/Week3/homework/js-execices/dogYears.js new file mode 100644 index 000000000..26a2b54c0 --- /dev/null +++ b/Week3/homework/js-execices/dogYears.js @@ -0,0 +1,7 @@ +'use strict' +function calculateDogAge(age){ + console.log("Your doggie is "+age/7+" years old in dog years!"); +} +calculateDogAge(8); +calculateDogAge(9); +calculateDogAge(10); diff --git a/Week3/homework/js-execices/fortuneTeller.js b/Week3/homework/js-execices/fortuneTeller.js new file mode 100644 index 000000000..0c4d1d790 --- /dev/null +++ b/Week3/homework/js-execices/fortuneTeller.js @@ -0,0 +1,9 @@ +'use strict' +function tellFortune(nbChild, partName, locGeog, workName){ + console.log("You will be a "+workName+" in "+locGeog+", and married to "+partName+" with "+nbChild+" kids."); +} +let childTab=[0, 1, 2, 3, 4]; +let partenerTab=["Binta", "Idiatou", "Djenabou", "Kadiatou", "Mariama"]; +let geogTab=["Daresalam 1", "Hamdalaye 1", "Hafia 2", "Cimenterie", "Kamsar"]; +let jobTab=["Programmar", "Mecanician", "Nurse", "Commercant", "Economist"]; +tellFortune(childTab[Math.floor(Math.random() * 5)], partenerTab[Math.floor(Math.random() * 5)], geogTab[Math.floor(Math.random() * 5)], jobTab[Math.floor(Math.random() * 5)]); \ No newline at end of file diff --git a/Week3/homework/js-execices/giveComplim.js b/Week3/homework/js-execices/giveComplim.js new file mode 100644 index 000000000..931d5abc0 --- /dev/null +++ b/Week3/homework/js-execices/giveComplim.js @@ -0,0 +1,8 @@ +'use strict' +function giveCompliment (name){ + let comTab=["great", "beautiful", "awesome", "nice", "happy", "sociable", "amiable", "shy", "friendly", "elegant"]; + console.log("You are "+comTab[Math.floor(Math.random() * 10)]+" "+name); +} +giveCompliment("Balde"); +giveCompliment("Balde"); +giveCompliment("Balde"); diff --git a/Week3/homework/js-execices/shopMarket.js b/Week3/homework/js-execices/shopMarket.js new file mode 100644 index 000000000..a1453d0c6 --- /dev/null +++ b/Week3/homework/js-execices/shopMarket.js @@ -0,0 +1,13 @@ +'use strict' +function addToShoppingCart(article){ + if (epicerieTab.length>2){ + epicerieTab.shift(); + } + epicerieTab.push(article); + console.log("You bought "+epicerieTab); + +} +let epicerieTab=["Bananas", "Milk"]; +addToShoppingCart("Mangue"); +addToShoppingCart("Orange"); +addToShoppingCart("Fraise"); \ No newline at end of file diff --git a/Week3/homework/js-execices/totalCost.js b/Week3/homework/js-execices/totalCost.js new file mode 100644 index 000000000..d9507fe44 --- /dev/null +++ b/Week3/homework/js-execices/totalCost.js @@ -0,0 +1,17 @@ +'use strict' +function calculateTotalPrice(price) { + let cal=0; + for(let obj in price){ + cal+=price[obj]; + } + console.log("the total price of all items is : "+cal+"euros") +} + +let cartForParty={ + oil: 6.88, + paper: 0.75, + vegetable:5.22, + Milk : 0.65, + Mayonnaise: 1.43 +} +calculateTotalPrice(cartForParty); \ No newline at end of file