|
| 1 | +## Variables #1 |
| 2 | + |
| 3 | +1. create "firstName" and "last_name" variables |
| 4 | +2. assign your values |
| 5 | +3. create "address" variable and assign "main street" |
| 6 | + value to it |
| 7 | +4. re-assign address to "first street" later |
| 8 | +5. log all values in the console |
| 9 | + |
| 10 | +## Concatenate Strings #2 |
| 11 | + |
| 12 | +1. create "street" and "country" variables |
| 13 | +2. assign your values |
| 14 | +3. create "fullMailingAddress" variable and assign |
| 15 | + the result of "street + country" |
| 16 | +4. remember about the space |
| 17 | +5. log "fullMailingAddress" in the console |
| 18 | + |
| 19 | +## Numbers #3 |
| 20 | + |
| 21 | +1. create "score1", "score2", "score3" variables and |
| 22 | + assign values (0-100) |
| 23 | +2. calculate total score and average score, and assign them to the variables. |
| 24 | +3. log total score and average score |
| 25 | +4. create "plates" variable and assign 20 |
| 26 | +5. create "people" variable and assign 7 |
| 27 | +6. calculate remaining plates and assign to the variable |
| 28 | +7. add one to remaining plates |
| 29 | +8. create message variable and display 'There are (your value goes here) plates available' - string concatenation |
| 30 | +9. log message |
| 31 | + |
| 32 | +## Arrays #4 |
| 33 | + |
| 34 | +1. create "fruits" array and store some fruit values |
| 35 | +2. setup the last item as number (random) |
| 36 | +3. assign first fruit to the variable |
| 37 | +4. re-assign last array item to the actual fruit |
| 38 | +5. log both first fruit variable and entire fruits array |
| 39 | + |
| 40 | +## Functions #5 |
| 41 | + |
| 42 | +1. create "calculateTotal" function |
| 43 | +2. add two parameters subTotal, tax |
| 44 | +3. return sum of parameters |
| 45 | +4. create 3 vars "order1","order2","order3" |
| 46 | +5. call calculateResult, pass in some values and assign result to each order |
| 47 | +6. log all three orders |
| 48 | +7. refactor "calculateTotal" to function expression |
| 49 | + |
| 50 | +## Objects #6 |
| 51 | + |
| 52 | +1. create car object |
| 53 | +2. add make, model, year, colors (array), |
| 54 | + hybrid (boolean) keys |
| 55 | +3. add two methods (drive and stop) |
| 56 | +4. in the function body setup log with random text |
| 57 | +5. log make |
| 58 | +6. log first color |
| 59 | +7. invoke both methods |
| 60 | + |
| 61 | +## Conditional Statements #7 |
| 62 | + |
| 63 | +1. create two objects "person1", "person2" |
| 64 | +2. setup name,age (15-25), |
| 65 | + status ('resident', 'tourist') keys |
| 66 | + |
| 67 | +3. setup if else, condition where |
| 68 | + age must be bigger than 18 and status must be |
| 69 | + equal to 'resident' |
| 70 | +4. test with both objects |
| 71 | + |
| 72 | +## Strings #8 |
| 73 | + |
| 74 | +1. create function fullName |
| 75 | +2. accept two parameters "firstName", "lastName" |
| 76 | +3. add them together (concat) and return result in uppercase |
| 77 | +4. invoke fullName and pass some values |
| 78 | +5. log result |
| 79 | +6. change the order of arguments |
| 80 | +7. refactor to object parameter |
| 81 | + |
| 82 | +## Array Methods #9 |
| 83 | + |
| 84 | +Multiple Videos |
| 85 | + |
| 86 | +#### Create Students Array |
| 87 | + |
| 88 | +1. setup students array with 5 students |
| 89 | + { |
| 90 | + id: 1, |
| 91 | + name: 'peter', |
| 92 | + score: 80, |
| 93 | + favoriteSubject: 'math', |
| 94 | + }, |
| 95 | + |
| 96 | +#### Use Multiple Files |
| 97 | + |
| 98 | +- easer to manage code base (file, project) |
| 99 | +- order matters |
| 100 | +- other ways to achieve the same result (ES6 modules, fetch DB ) |
| 101 | +- not limited to just static data |
| 102 | + |
| 103 | +#### updatedStudents |
| 104 | + |
| 105 | +1. add role:'student' property to each object |
| 106 | + using MAP method |
| 107 | +2. assign to 'updatedStudents' variable and log |
| 108 | + |
| 109 | +#### highScores |
| 110 | + |
| 111 | +1. filter array and return only scores >= 80 |
| 112 | +2. assign to 'highScores' variable and log |
| 113 | + |
| 114 | +#### specificId |
| 115 | + |
| 116 | +1. find specific id in array |
| 117 | +2. assign to 'specificId' variable and log |
| 118 | + |
| 119 | +#### averageScore |
| 120 | + |
| 121 | +1. sum up all student.score values with reduce |
| 122 | +2. divide by the length of the students array |
| 123 | +3. assign to 'averageScore' and log |
| 124 | + |
| 125 | +#### survey |
| 126 | + |
| 127 | +1. list favorite subjects with reduce |
| 128 | + { |
| 129 | + english: 1 |
| 130 | + history: 1 |
| 131 | + math: 3 |
| 132 | + } |
| 133 | +2. assign to survey and log |
0 commit comments