└── README.md /README.md: -------------------------------------------------------------------------------- 1 | # array-looping-tasks 2 | 3 | ### Task 1 4 | 5 | Write a JavaScript code to reverse the array colors `without using the reverse method`. 6 | 7 | **Input:** 8 | `const colors = ['red', 'blue', 'green', 'yellow', 'orange']` 9 | 10 | **Output:** 11 | 12 | `['orange', 'yellow', 'green', 'blue', 'red']` 13 | 14 | --- 15 | 16 | ### Task 2 17 | 18 | Write a JavaScript code to get the even numbers from an array using any looping technique. 19 | 20 | **Input:** 21 | `const numbers = [12, 98, 5, 41, 23, 78, 46];` 22 | 23 | **Output:** 24 | 25 | `[12, 98, 76, 46]` 26 | 27 | --- 28 | 29 | 30 | ### Task 3 31 | 32 | Use a for...of loop to concatenate all the elements of an array into a single string. 33 | 34 | **Input:** 35 | `var numbers = ['Tom', 'Tim', 'Tin', 'Tik']` 36 | 37 | **Output:** 38 | 39 | `'TomTimTinTik'` 40 | 41 | --- 42 | 43 | ### Task 4 (Hard) 44 | 45 | Reverse the words of a sentence. Only the position of the word will be reversed. check out the output 46 | 47 | **Input:** 48 | `const statement = 'I am a hard working person'` 49 | 50 | **Output:** 51 | 52 | `'person working hard a am I'` 53 | 54 | --- 55 | --------------------------------------------------------------------------------