Skip to content

Instantly share code, notes, and snippets.

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);
/*
Last time
* Conditionals (rps mini game)
This time
* Functions
* Iteration (for and while loop)
// 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
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