Skip to content

Latest commit

 

History

History
47 lines (29 loc) · 1.37 KB

File metadata and controls

47 lines (29 loc) · 1.37 KB

JavaScript Foundations - Part 1 (Class 2)

Exercise #1: Basic

Aim: Create a variable for every JavaScript Data Type

  • Create a variable that holds a string value
  • Create a variable that holds a number value
  • Create a variable that holds a boolean value
  • Create a variable that holds a null value
  • Create a variable that holds an undefined value
  • Create a variable that points to an object instance
  • Create a variable that points to an array instance
  • Create a variable that has no default value declaration


Exercise #2: Intermediate

Aim: Dynamically display a list of food items and prices using HTML & JavaScript

  • Create a LIST of OBJECTS, each object having a name and price property
  • LOOP over that LIST, dynamically create a new list item <li></li> with the food name inside, and append that item to an existing HTML <ul></ul> element


Exercise #3: Advanced

Aim: Create a function that takes two numbers as arguments (num, length) and returns an array of multiples of num until the array length reaches length.

Examples

arrayOfMultiples(7, 5)        [7, 14, 21, 28, 35]

arrayOfMultiples(12, 10)        [12, 24, 36, 48, 60, 72, 84, 96, 108, 120]

arrayOfMultiples(17, 6)        [17, 34, 51, 68, 85, 102]

Notes

  • Notice that num included in the returned array.