Skip to content

Instantly share code, notes, and snippets.

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
// Super basic assertion
// console.log(square(2) === 4);
// Now, let's try writing an assertion that gives us a little more information about what's going on.
/* Write a function, assertEqual, that takes in 3 arguments:
- An invocation of the function you're testing
- The expected output of the function you're testing
/*
Last time
* Conditionals (rps mini game)
This time
* Functions
* Iteration (for and while loop)

Set D

Prompt

//1. Write a function that takes in a number, and returns a string with that many number of stars ("*").

After prompt number 1, you are given this :

function assert(expectedBehavior, descriptionOfCorrectBehavior) {
  if (!expectedBehavior) {
    console.log(descriptionOfCorrectBehavior);

Set C

Prompt

//1. Write a function that checks if the given input is an object.

After prompt number 1, you are given this :

function assert(expectedBehavior, descriptionOfCorrectBehavior) {
  if (!expectedBehavior) {
    console.log(descriptionOfCorrectBehavior);

Set B:

Prompts

//1. extendObject takes in an object, property, and value as parameters and adds the property and value to the object. If the property already exists, overwrite its current value with the new value. Return the object to the user.

Example:

Set A:

Prompts

//1. collectKeys takes an object and returns an array filled with all of they keys inside of the collection.

Example:

  var obj = {course: 'Reactor Prep', best: true};
 collectKeys(obj) // ['course', 'best'];
var library = {
books: {
orwell: ['1984', 'animal farm'],
hemingway: ['A Farewell to Arms', 'The Old Man and the Sea', 'The Sun Also Rises']
},
plays: {
shakespeare: ['romeo and juliet', 'macbeth']
}
};
// Data type
// Examples: String, number, boolean
// Data structure
// Examples: arrays, objects
var firstName = "Ram";
var age = "30";