You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -534,7 +528,6 @@ Another way to write conditionals is using ternary operators.
534
528
```js
535
529
let isRaining =true;
536
530
isRaining ?console.log('You need a rain coat.') :console.log('No need for a rain coat.')
537
-
538
531
```
539
532
#### Exercises:Flow Control
540
533
- Get user input using prompt(“Enter your age:”). If user is 18 or older , give feedback:You are old enough to drive but if not 18 give feedback to wait for the years he supposed to wait for.
@@ -603,13 +596,13 @@ do {
603
596
1. Use for loop to iterate from 0 to 100 and print only even numbers
604
597
1. Use for loop to iterate from 0 to 100 and print only odd numbers
605
598
1. Use for loop to iterate from 0 to 100 and print and print the sum of all numbers.
606
-
```js
607
-
The sum all numbers is 5050.
608
-
```
599
+
```js
600
+
The sum all numbers is 5050.
601
+
```
609
602
1. Use for loop to iterate from 0 to 100 and print the sum of all evens and the sum of all odds.
610
-
```js
611
-
The sum of all evens is 2550. And the sum of all odds is 2500.
612
-
```
603
+
```js
604
+
The sum of all evens is 2550. And the sum of all odds is 2500.
605
+
```
613
606
614
607
## Functions
615
608
A function is a block of code designed to perform a certain task.
@@ -787,11 +780,16 @@ const square = n => n * n; // -> 4
787
780
rgb(125,244,255)
788
781
```
789
782
1. Write a function name *displayDateTime* and it display in this format: 28/08/2018 04:08
790
-
1. Use the new Date() object to get month, date, year, hour and minute.
783
+
1. Use the new Date() object to get *month, date, year, hour* and *minute*.
791
784
Output:
792
785
```sh
793
786
28/08/201804:08
794
787
```
788
+
1. Call your function *shuffleArray*, it takes an array as a parameter and it returns a shuffled array
789
+
1. Call your function *factorial*, it takes a whole number as a parameter and it return a factorial of the number
790
+
1. Call your function *isEmpty*, it takes a parameter and it checks if it is empty or not
791
+
1. Call your function *sum*, it takes any number of arguments and it returns the sum.
792
+
795
793
## Object
796
794
Everything can be an object and objects do have properties and properties have values.
0 commit comments