To code this project you need to know:
Repeating Tasks Manually , The For Loop , Looping in Reverse , Looping through Arrays , Nested Loops , The While Loop , Do...While Statements , The break Keyword
If you are not familier with them please download Learn JavaScript eBook from https://codingwithbasir.com/learn-javascript
- Create a html file with your name like john.html
- Add current code to that file:
<!DOCTYPE html>
<html>
<body>
<script>
// your code here
</script>
</body>
</html>
- Create a for loop and log odd numbers from 1 to 11:
- Create a for loop and log event numbers from 11 to 1 in reverse:
- Define an array named
myList
and put these items into it:
- Fruits
- Milk
- Cheese
- Baken
- Bread
-
Log all item in the array into console with a for loop.
-
Create new array named
fruits
and set it to[['apple','orange','banana],['coconut','cumbersome'],['starbery','bluebery']]
-
Create nested for loops to log all items inside
fruits
in seperate lines. -
Use do while to log
myList
items in reverse mode. First logBread
, thenBaken
, etc