Skip to content

Latest commit

 

History

History

02-javascript-basics

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

JavaScript Basics Lecture

Complementary Material

Exercice 1: Create a BMI system with Prompt and Alert.

BMI Formula

Rules:

Category from to
Underweight 18.5
Normal Range 18.5 23
Overweight—At Risk 23 25
Overweight—Moderately Obese 25 30
Overweight—Severely Obese 30

Exercice 2: Create a calculator

Exercice 3: Create a Pokemon Battle System

Homework:

Homework:

  1. Create a calculator factory that operates with arrays.
  2. The method sum should works with numbers and strings.
    // Numbers
    [1, 2, 3, 4, 5] // 15
    [10, 20, 30, 40, 50] // 150
    
    // Strings
    ["one, ", "two, ", "three"] // "one, two, three"
    ["hey, ", "what's ", "up", "?"] // "hey, what's up?"
  3. The method sumAndSquare should sum a collection and then square the sum.
    [1, 2, 3, 4, 5] // 225
    [10, 11, 12, 13, 14] // 3600
  4. The method onlyEvens should filter out odd numbers.
    [1, 2, 3, 4, 5, 6] // [2, 4, 6]
    [7, 8, 9, 10, 11, 12] // [8, 10, 12]
  5. The method onlyOdds should filter out even numbers.
    [1, 2, 3, 4, 5, 6] // [1, 3, 5]
    [7, 8, 9, 10, 11, 12] // [7, 9, 11]
  6. The method squareAndSum should square every number in a collection and then summing them.
    [1, 2, 3, 4, 5, 6] // 91