diff --git a/1-exercises/A-undefined/exercise.js b/1-exercises/A-undefined/exercise.js index 0acfc78d..348a0081 100644 --- a/1-exercises/A-undefined/exercise.js +++ b/1-exercises/A-undefined/exercise.js @@ -1,7 +1,7 @@ /* By now, you would have already seen "undefined", either in an error message or being output from your program. But what does it mean? undefined represents the absence of a value. - + In some cases, undefined will be used by a programmer intentionally, and they will write code to handle it. But usually, when you see undefined - it means something has gone wrong! @@ -12,25 +12,28 @@ // Example 1 let a; console.log(a); - +/*we saw undefine output because we declared variable and + we didn't assign any value ,that's mean nothing to display.*/ // Example 2 function sayHello() { let message = "Hello"; -} +} let hello = sayHello(); console.log(hello); - +/* we saw undefine output because function doesn't return or output anything*/ // Example 3 function sayHelloToUser(user) { console.log(`Hello ${user}`); } - sayHelloToUser(); +/* we saw undefine output because we didn't assign any value for the variable 'user' +that's mean the variable is empty*/ // Example 4 let arr = [1,2,3]; console.log(arr[3]); +/*we saw undefine we don't have index[3] in the array */ \ No newline at end of file diff --git a/1-exercises/B-array-literals/exercise.js b/1-exercises/B-array-literals/exercise.js index 51eba5cc..1b457b0c 100644 --- a/1-exercises/B-array-literals/exercise.js +++ b/1-exercises/B-array-literals/exercise.js @@ -4,16 +4,16 @@ Declare some variables assigned to arrays of values */ -let numbers = []; // add numbers from 1 to 10 into this array -let mentors; // Create an array with the names of the mentors: Daniel, Irina and Rares +let numbers = [1,2,3,4,5,6,7,8,9,10]; // add numbers from 1 to 10 into this array +let mentors =['Daniel', 'Irina', 'Rares']; // Create an array with the names of the mentors: Daniel, Irina and Rares -/* +/* DO NOT EDIT BELOW THIS LINE --------------------------- */ console.log(numbers); console.log(mentors); -/* +/* EXPECTED RESULT --------------- [1,2,3,4,5,6,7,8,9,10] diff --git a/1-exercises/C-array-get-set/exercise.js b/1-exercises/C-array-get-set/exercise.js index 5ca911d5..e5003bcf 100644 --- a/1-exercises/C-array-get-set/exercise.js +++ b/1-exercises/C-array-get-set/exercise.js @@ -5,14 +5,14 @@ */ function first(arr) { - return; // complete this statement + return arr[0]; // complete this statement } function last(arr) { - return; // complete this statement + return arr[arr.length-1]; // complete this statement } -/* +/* DO NOT EDIT BELOW THIS LINE --------------------------- */ let numbers = [1, 2, 3]; @@ -22,7 +22,7 @@ console.log(first(numbers)); console.log(last(numbers)); console.log(last(names)); -/* +/* EXPECTED RESULT --------------- 1 diff --git a/1-exercises/C-array-get-set/exercises2.js b/1-exercises/C-array-get-set/exercises2.js index 6b6b007a..aca3ba5d 100644 --- a/1-exercises/C-array-get-set/exercises2.js +++ b/1-exercises/C-array-get-set/exercises2.js @@ -7,13 +7,13 @@ */ let numbers = [1, 2, 3]; // Don't change this array literal declaration - -/* + numbers.push(4) +/* DO NOT EDIT BELOW THIS LINE --------------------------- */ console.log(numbers); -/* +/* EXPECTED RESULT --------------- [1, 2, 3, 4] diff --git a/1-exercises/D-for-loop/exercise.js b/1-exercises/D-for-loop/exercise.js index 081002b2..96b9ea28 100644 --- a/1-exercises/D-for-loop/exercise.js +++ b/1-exercises/D-for-loop/exercise.js @@ -27,7 +27,9 @@ const AGES = [ ]; // TODO - Write for loop code here - +for(let i=0 ;i`The temperature in ${city} is ${temperatureService(city)} degrees`); + + } + + /* ======= TESTS - DO NOT MODIFY ===== */ @@ -28,10 +31,13 @@ function temperatureService(city) { temparatureMap.set('Mumbai', 29); temparatureMap.set('São Paulo', 23); temparatureMap.set('Lagos', 33); - + return temparatureMap.get(city); } - +test('should return array of same length as argument',()=>{ + let usersCities = ['London', 'Paris', 'Barcelona']; + expect(getTemperatureReport(usersCities).length).toEqual(3); +}) test("should return a temperature report for the user's cities", () => { let usersCities = [ "London", diff --git a/2-mandatory/2-financial-times.js b/2-mandatory/2-financial-times.js index 2ce6fb73..978cea2f 100644 --- a/2-mandatory/2-financial-times.js +++ b/2-mandatory/2-financial-times.js @@ -5,7 +5,14 @@ Implement the function below, which will return a new array containing only article titles which will fit. */ function potentialHeadlines(allArticleTitles) { + let titles=[]; + for (let i=0; i