diff --git a/data/assignments.js b/data/assignments.js index e69de29..396017d 100644 --- a/data/assignments.js +++ b/data/assignments.js @@ -0,0 +1,7 @@ + +const assignments = [ + {name: 'Alice',completed: false}, + {name: 'Beryl', completed: true }, + {name: 'Carol', completed: false}] + +module.exports = { assignments } diff --git a/index.js b/index.js index a4899ce..4589990 100644 --- a/index.js +++ b/index.js @@ -2,13 +2,14 @@ We will push to github all along the way so we track our week and keep a log + a) code in git, start working, first step: git checkout -b answer + Declaring an Array with Objects 1) Declare and initialize an array of `assignments` with `name` and `completed` properties. Name the array `assignments`. `completed` will have boolean values. */ - - +const { assignments } = require('./data/assignments') /** Referencing code in other files @@ -29,7 +30,9 @@ 3) Loop through the data using a for loop. Just console.log within the loop to show each item within the array */ - +for(let i = 0;i< assignments.length; i++) { + console.log(assignments[i]) +} /** Looping and Assignment @@ -37,8 +40,12 @@ 4) Declare a new array named `allAssignments`. Loop through the `assignments` array data using a for loop and assign each item from `assignments` to the new `allAssignments` array */ - - +console.log('= = = = = = = = =') +let allAssignments = [] +for(let i = 0; i