|
| 1 | +//1 |
| 2 | +console.log('Hallo', 'wereld!'); // Dutch; |
| 3 | +console.log('hola', 'mundo!'); //spanish |
| 4 | +console.log('مرحبا', 'العالم!'); //Arabic |
| 5 | +//2 |
| 6 | +console.log("I'm awesome"); // should use two quotations instead of one |
| 7 | +//3 |
| 8 | +const x; |
| 9 | +console.log('the value of my variable x will be: undefined'); |
| 10 | +x = 7; // initialize the value of x |
| 11 | +console.log('the value of my variable x will be 7'); |
| 12 | +console.log(x); |
| 13 | +//4 |
| 14 | +let y; |
| 15 | +y = 'hyf'; |
| 16 | +console.log('the value of y will be :hyf'); |
| 17 | +console.log(y); |
| 18 | +let y = 'code'; |
| 19 | +console.log('the value of y will be :code'); |
| 20 | +console.log(y); |
| 21 | +//5 |
| 22 | +const z = 7.25; |
| 23 | +console.log(z); |
| 24 | +const a = Math.floor(z); |
| 25 | +console.log(a); |
| 26 | +const max = Math.max(z, a); |
| 27 | +console.log(max);//math.floor() rounds the number generated by math.random() down to the last integer. math round used to round a number to its nearest integer |
| 28 | +//6 |
| 29 | +const myLibraries = []; |
| 30 | +console.log('the value of the the array is []'); |
| 31 | +const myFavoriteAnimals = ['dogs', 'elephants', 'turtles', 'cats']; |
| 32 | +console.log(myFavoriteAnimals); |
| 33 | +const newLength = myFavoriteAnimals.push('baby pig'); |
| 34 | +console.log(newLength); |
| 35 | +//7 |
| 36 | +const len = myString.length; |
| 37 | +console.log(len); |
| 38 | +//8 |
| 39 | +const a = 4; |
| 40 | +console.log('the value of my const a is :4'); |
| 41 | +const b = 'dog'; |
| 42 | +console.log('the value of my variable animal is :dog'); |
| 43 | +const c = true; |
| 44 | +console.log('the value of my variable age28 is : true'); |
| 45 | +const d = [1, 2, 3, 4]; |
| 46 | +console.log('the value of variable a is:' + 'number'); |
| 47 | +console.log('the value of variable b is :' + 'string '); |
| 48 | +console.log('the value of c variable is : ' + 'boolean'); |
| 49 | +console.log('the value of variable d is :' + 'array '); |
| 50 | +const typeA = 4; |
| 51 | +typeof typeA; //number |
| 52 | +const typeB = 'dog'; |
| 53 | +typeof typeB; //string |
| 54 | +const typeC = true; |
| 55 | +typeof typeC; // boolean |
| 56 | +const typeD = [1, 2, 3, 4]; |
| 57 | +typeof typeD; // number |
| 58 | +console.log(typeof typeA); |
| 59 | +console.log(typeof typeB); |
| 60 | +console.log(typeof typeC); |
| 61 | +console.log(typeof typeD); |
| 62 | +if (typeA === typeB, typeA === typeC || typeA === typeD) { |
| 63 | + console.log('same type'); |
| 64 | +} |
| 65 | +if (typeA != typeB, typeA != typeC || typeA != typeD) { |
| 66 | + console.log('Not the same type'); |
| 67 | +} |
| 68 | +//9 |
| 69 | +let x = 7; |
| 70 | +x = x % 3; |
| 71 | +console.log('the value of x is :1 '); |
| 72 | +let y = 8; |
| 73 | +y = y % 6; |
| 74 | +console.log(2); |
| 75 | +let z = 4; |
| 76 | +z = z % 3; |
| 77 | +console.log(1); |
| 78 | +let b = 11; |
| 79 | +b = b % 2; |
| 80 | +console.log(1); |
| 81 | +//10 |
| 82 | +let arr = [1, 'dog', 32, 'baby']; // you can add different types of values in one array. |
| 83 | +// you can compare infinities |
| 84 | +let x = "Not in Eyad's world"; |
| 85 | +var b = 6 / 0; |
| 86 | +let c = 10 / 0; |
| 87 | +if (b === c) { |
| 88 | + console.log(true); // it shows true then you can compare infinities |
| 89 | +} |
| 90 | +let x = 4; |
| 91 | +let y = 0; |
| 92 | + |
| 93 | +console.log(x / y); // it shows infinity |
| 94 | + |
0 commit comments