forked from RBK-RebootKampTunisiaCohort3/warmUp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwarmUp7.js
37 lines (31 loc) · 962 Bytes
/
warmUp7.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// 1-Choose the correct comparison operator to display "true", when: 5 is less than 7.
<<<<<<< HEAD
//answer :
5 !== 7 ;
=======
//answer : 5 < 7 ? true : false;
>>>>>>> 61b0662bb14ae4fe1668c5e0f12461a2bba0362d
//2- Write a function named helloWorld that:
//takes 1 argument, a language code (e.g. "fr", "es", "en")
//returns "Hello, World" for the given language, for atleast 3 languages. It should default to returning English.
//ex: helloWorld('fr') ==> 'Bonjour tout le monde'
// helloWorld('es') ==> 'Hola, Mundo'
// helloWorld('') ==> 'Hello, World'
function helloWorld(str){
if (str === "fr"){
return "Bonjour tout le monde";
}
else if (str === "es"){
return "Hola, Mundo";
}
return "hello, world";
}
//3- write a function to Reverse an array without use array.reverse() method:
// ex: reverseArray([1,2,3]) ==> [3,2,1]
function reverse(array){
let arr = [];
for (let i = array.length; i > 0; i--){
arr.push(i);
}
return arr;
}