Skip to content

Instantly share code, notes, and snippets.

Introduction to Arrays

Lesson

Slides

Exercises

Basic Requirements

Introduction to Objects

Lesson

Slides

Exercises

Basic Requirements

name mass radius hzd
Kepler-9 d 0.02 2 -2.42
PSR 1257 12 b 0.02 0.31 -2.31
Kepler-37 b 0.02 0.32 -2.16
Mercury 0.06 0.38 -1.71
KIC-12557548 b 0.1 0.85 -2.26
Mars 0.11 0.53 0.5
Kepler-62 c 0.12 0.54 -2.01
Kepler-42 d 0.14 0.57 -1.72
KOI-82 d 0.26 0.69 -2.14

Exercises

  1. Write a function called billTotal that can be used to calculate the total to be paid at a restaurant -- including tip and tax -- given the subtotal (i.e. cost of food and drinks). We can assume that the tip will be 15% and tax will be 9.5%. Make sure that the tip does not include the tax!

  2. Complete the below function called range that takes two integers as parameters, start and end, and returns an array containing all the whole numbers between them starting with start and up to end (you can use a any loop. The function

Module 2 Assessment

Sales Team

You are managing a sales team and you are interested is analyzing some data related to their age and total sales. Take a moment to review the following data structure you will be analyzing:

var salesTeam = [{name: {first: 'Aleen', last: 'Atkins'}, age: 26, sales: '$2314'},
 		{name: {first: 'Alvaro', last: 'Angelos'}, age: 55, sales: '$1668'},
 		{name: {first: 'Denese', last: 'Dossett'}, age: 29, sales: '$9248'},

Introduction to Functions

Lesson

Slides

Exercises

Basic Requirements

  1. In the console or repl.it, try the following and verify

Slides

  1. Write a function called average that takes an array of numbers as a parameter and returns the average of those numbers.

    After you write your function, you can test it using the above inputs to make sure that it behaves correctly.

  2. Write a function called min that finds the smallest number in an array of numbers.

Exercises

Basic Requirements

Numbers

  1. Enter the following expressions into your console.

1 + 2