Skip to content

Latest commit

 

History

History

project-javascript-g1-loops

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Project JavaScript G1 Shooping List

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

Project Title: Shopping List

  1. Create a html file with your name like john.html
  2. Add current code to that file:
<!DOCTYPE html>
<html>
  <body>
    <script>
      // your code here
    </script>
  </body>
</html>
  1. Create a for loop and log odd numbers from 1 to 11:
  2. Create a for loop and log event numbers from 11 to 1 in reverse:
  3. Define an array named myList and put these items into it:
  • Fruits
  • Milk
  • Cheese
  • Baken
  • Bread
  1. Log all item in the array into console with a for loop.

  2. Create new array named fruits and set it to[['apple','orange','banana],['coconut','cumbersome'],['starbery','bluebery']]

  3. Create nested for loops to log all items inside fruits in seperate lines.

  4. Use do while to log myList items in reverse mode. First log Bread, then Baken , etc