Skip to content
This repository was archived by the owner on Mar 14, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions week-1/Extra/1-syntax-errors.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
// There are syntax errors in this code - can you fix it to pass the tests?

function addNumbers(a b c) {
function addNumbers(a ,b, c) {
return a + b + c;
}

function introduceMe(name, age)
return "Hello, my name is " + name "and I am " age + "years old";
return "Hello, my name is " + name +" and I am "+ age + "years old";

function getTotal(a, b) {
total = a ++ b;
total = a + b;

// Use string interpolation here
return "The total is %{total}"
return `The total is ${total}`
}

/* ======= TESTS - DO NOT MODIFY =====
Expand Down
2 changes: 1 addition & 1 deletion week-1/Extra/2-logic-error.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// The syntax for this function is valid but it has an error, find it and fix it.

function trimWord(word) {
return wordtrim();
return word.trim();
}

function getWordLength(word) {
Expand Down
9 changes: 7 additions & 2 deletions week-1/Extra/4-tax.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
Sales tax is 20% of the price of the product
*/

function calculateSalesTax() {}
function calculateSalesTax(price,tax) {
return price*tax
}
calculateSalesTax(500,20%)

/*
CURRENCY FORMATTING
Expand All @@ -17,7 +20,9 @@ function calculateSalesTax() {}
Remember that the prices must include the sales tax (hint: you already wrote a function for this!)
*/

function addTaxAndFormatCurrency() {}
function addTaxAndFormatCurrency( price,tax) {
return price+tax
}

/* ======= TESTS - DO NOT MODIFY =====
There are some Tests in this file that will help you work out if your code is working.
Expand Down
8 changes: 7 additions & 1 deletion week-1/Homework/F-strings-methods/exercise.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Start by creating a variable `message`
var na= "mamadou";
var na1=na.length
var text= `ny name is ${na} it is composed of ${na1} caracters `;

console.log(message);

console.log(text);
var mes
var
6 changes: 5 additions & 1 deletion week-1/Homework/F-strings-methods/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
const name = " Daniel ";
const pas = " Daniel ";
const trimpas=pas.trim()
const lenpas=trimpas.length
var message=" my name is "+trimpas+ " and my name has " +lenpas+" carracters";

console.log(message);

1 change: 1 addition & 0 deletions week-1/Homework/J-functions/exercise.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function halve(number) {
// complete the function here
return number/2;
}

var result = halve(12);
Expand Down
1 change: 1 addition & 0 deletions week-1/Homework/J-functions/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
function triple(number) {
// complete function here
return number*3;
}

var result = triple(12);
Expand Down
5 changes: 3 additions & 2 deletions week-1/Homework/K-functions-parameters/exercise.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Complete the function so that it takes input parameters
function multiply() {
function multiply(hour , price) {
return hour*price;
// Calculate the result of the function and return it
}
}

// Assign the result of calling the function the variable `result`
var result = multiply(3, 4);
Expand Down
4 changes: 4 additions & 0 deletions week-1/Homework/K-functions-parameters/exercise2.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Declare your function first
function divide(height,mass) {
return height/mass;

}

var result = divide(3, 4);

Expand Down
5 changes: 5 additions & 0 deletions week-1/Homework/K-functions-parameters/exercise3.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
// Write your function here
function createGreeting(name){
var message =` hello, my name is ${name}.`;
return message

}

var greeting = createGreeting("Daniel");

Expand Down
4 changes: 4 additions & 0 deletions week-1/Homework/K-functions-parameters/exercise4.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Declare your function first
function passing(num1,num2){
return num1+num2
}
var sum =passing(13,124)

// Call the function and assign to a variable `sum`

Expand Down
4 changes: 4 additions & 0 deletions week-1/Homework/K-functions-parameters/exercise5.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Declare your function here
function createLongGreeting(name,age){
var message=` hello my name is ${name} and i am ${age} years old.`
return message
}

const greeting = createLongGreeting("Daniel", 30);

Expand Down
17 changes: 17 additions & 0 deletions week-1/Homework/L-functions-nested/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,20 @@ var mentor2 = "Irina";
var mentor3 = "Mimi";
var mentor4 = "Rob";
var mentor5 = "Yohannes";
var greeting="hello"

function upper(greeting){
return greeting.toUpperCase();
}
//console.log(upper(greeting))

function bigup(name,greeting){
var up= upper(greeting)
return up+" " +name
console.log(bigup)
}
console.log(bigup(mentor1,greeting));
console.log(bigup(mentor2,greeting));
console.log(bigup(mentor3,greeting));
console.log(bigup(mentor4,greeting));
console.log(bigup(mentor5,greeting));
1 change: 1 addition & 0 deletions week-1/InClass/exercise-A.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
console.log("hi")
13 changes: 13 additions & 0 deletions week-1/InClass/exercise-B.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
var doto= "word";
console.log("hello " + doto);

console.log("hello "+ doto);
var doto= "world";
console.log("hello " + doto);
var world= "mond";
console.log("hello "+ world);
var world= "mundo";
var world= "aduna";
console.log("hello "+ world);


2 changes: 2 additions & 0 deletions week-1/InClass/exercise-C.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
const greeting =" Hi"
console.log(greeting)
4 changes: 4 additions & 0 deletions week-1/InClass/exercise-D.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const colors="blue ,yellow";
console.log(typeof colors)
const number = 34
console.log(typeof colors)
6 changes: 6 additions & 0 deletions week-1/InClass/exercise-E.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const pres="i live in ";
const city="barcelon";
const mytown= pres +city;
console.log(mytown)
const town=`actually ${pres} a city named ${city}`;
console.log(town)
4 changes: 4 additions & 0 deletions week-1/InClass/exercise-F.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
const numerofstudent=45;
const numberofmentor=20;
const total =numerofstudent+numberofmentor;
console.log(total)
7 changes: 7 additions & 0 deletions week-1/InClass/exercise-G.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
const numerofstudent=45;
const numberofmentor=20;
const total =numerofstudent+numberofmentor;

const nbrstudentpermentor=Math.round(numerofstudent/numberofmentor)*100 ;
const nbrmentorperstudent=Math.round(numberofmentor/numerofstudent)*100;
console.log(nbrmentorperstudent,nbrstudentpermentor)
11 changes: 11 additions & 0 deletions week-1/InClass/exercise-H.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function myage(my,age){
const myage=my+age;

console.log(myage)

}
var my=" i have "
var age="30 years"
myage(my, age)
/* THIS FUNCTION GIVE THE AGE OF THE PERSON*/
//Return is used to interrupt the flow of execution of a function and return some value (or not). console.log is used to print information to the console //
11 changes: 11 additions & 0 deletions week-1/InClass/exercise-I.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function calcby(yrs){
return 2021-yrs;
}

function myinfo(fulln,yofb){
const calcb =calcby(yofb)
const data="my name is "+fulln+" and i was born in "+calcb;
return data;
console.log(myinfo)
}
myinfo("marc",19)
11 changes: 11 additions & 0 deletions week-1/InClass/text.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function calcby(yrs){
return 2021-yrs;
}

function myinfo(fulln,yofb){
const calcb =calcby(yofb)
const data="my name is "+fulln+" and i was born in "+calcb;
return data;
console.log(myinfo)
}
myinfo("marc",19)
8 changes: 5 additions & 3 deletions week-2/Homework/C-comparison-operators/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,16 @@

var studentCount = 16;
var mentorCount = 9;
var moreStudentsThanMentors; // finish this statement
var moreStudentsThanMentors = studentCount>mentorCount;



var roomMaxCapacity = 25;
var enoughSpaceInRoom; // finish this statement
var enoughSpaceInRoom=roomMaxCapacity<=(studentCount+mentorCount) ;

var personA = "Daniel";
var personB = "Irina";
var sameName; // finish this statement
var sameName=personA===personB;

/*
DO NOT EDIT BELOW THIS LINE
Expand Down
5 changes: 5 additions & 0 deletions week-2/Homework/E-conditionals/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

var name = "Daniel";
var danielsRole = "mentor";
if(danielsRole==="mentor"){
console.log(`Hi,I am ${name}, i am a ${danielsRole}`)
}else if(danielsRole==="student"){
console.log(`Hi, I am ${name}, I am a${danielsRole}`)
}

/*
EXPECTED RESULT
Expand Down
8 changes: 4 additions & 4 deletions week-2/Homework/F-logical-operators/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ var cssLevel = 4;

// Finish the statement to check whether HTML, CSS knowledge are above 5
// (hint: use the comparison operator from before)
var htmlLevelAbove5;
var cssLevelAbove5;
var htmlLevelAbove5=(htmlLevel>cssLevel);
var cssLevelAbove5=(cssLevel>htmlLevel);

// Finish the next two statement
// Use the previous variables and logical operators
// Do not "hardcode" the answers
var cssAndHtmlAbove5;
var cssOrHtmlAbove5;
var cssAndHtmlAbove5=htmlLevel && cssLevel>5;
var cssOrHtmlAbove5= htmlLevel>5 || cssLevel>5;

/*
DO NOT EDIT BELOW THIS LINE
Expand Down
11 changes: 10 additions & 1 deletion week-2/Homework/F-logical-operators/exercise2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,16 @@
Update the code so that you get the expected result.
*/

function isNegative() {}
function isNegative() {
if(-10<0?true:false);
if(5<0?true:false);
if(10<=10&&10>5?true:false);

}





/*
DO NOT EDIT BELOW THIS LINE
Expand Down
2 changes: 2 additions & 0 deletions week-2/Homework/G-conditionals-2/exercise-1.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
*/

function negativeOrPositive(number) {
if(number>=0)return "positive";
else return "negative";

}

Expand Down
4 changes: 4 additions & 0 deletions week-2/Homework/G-conditionals-2/exercise-2.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@
*/

function studentPassed(grade) {
if(grade<=50){
return "failed";
}
else return"passed";

}

Expand Down
11 changes: 11 additions & 0 deletions week-2/Homework/G-conditionals-2/exercise-3.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@
*/

function calculateGrade(mark) {
if(mark>=80){
return "A";

}
else if(mark<80 & mark>60){
return"B";
}
else if(mark<=60 && mark>50){
return"c";
}
else return"f"

}

Expand Down
4 changes: 4 additions & 0 deletions week-2/Homework/G-conditionals-2/exercise-4.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
*/

function containsCode(sentence) {
if(sentence.includes("code")){
return true;
}
else return false;

}

Expand Down
4 changes: 2 additions & 2 deletions week-2/Homework/H-array-literals/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
Declare some variables assigned to arrays of values
*/

var numbers = []; // add numbers from 1 to 10 into this array
var mentors; // Create an array with the names of the mentors: Daniel, Irina and Rares
var numbers = [1,2,3,4,5,6,7,8,9,10]; // add numbers from 1 to 10 into this array
var mentors=["Daniel","Irina","Rares"]; // Create an array with the names of the mentors: Daniel, Irina and Rares

/*
DO NOT EDIT BELOW THIS LINE
Expand Down
6 changes: 5 additions & 1 deletion week-2/Homework/I-array-properties/exercise.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,11 @@
*/

function isEmpty(arr) {
return; // complete this statement
if(arr==""){
return true;
}
else
return false; // complete this statement
}

/*
Expand Down
Loading