forked from devleague/js-functions
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
53 lines (43 loc) · 1.7 KB
/
script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Please make sure all your code is added inside the `runAfterTests` function.
function runAfterTests() {
/**
* Follow the comments below.
* Feel free to use `console.log` to see what values are being returned.
*/
// Create a variable called `myNumber`, and assign it to any number
var myNumber = 7;
/**
* Create another variable called `stringValue`.
* Assign it the value that's returned when you pass
* `myNumber into the function `numberToString`.
*/
var stringValue = myNumber.numberToString();
/**
* If you pass `myNumber` and `stringValue` into `areEqual`,
* what value will you get back? Why is that?
*/
console.log(areEqual(myNumber,stringValue));
/**
* You may have noticed that the `calculate` function combined
* the functionality of `add`, `subtract`, `multiply`, and `divide`.
* Did you try to use those functions _inside_ of `calculate`?
* If you didn't go back and try it, this is called "reusability"!
*/
// Do you see any other functions where code could be reused?
/**
* For your `letterGrade` function,
* what happens if you provide a `score` that is less than 0,
* or greater than the `total` value?
* Does it still work as expected? If it doesn't, how could you improve this?
*/
/**
* Your `combine` function looks okay,
* but what if you wanted to join it with ANY string instead of a single space?
* Create a new function called `improvedCombine`,
* with the same parameters as `combine`, but also add a
* third parameter called `glue` (a string value).
*/
// What happens if you were to uncomment the following lines?
combine = improvedCombine;
console.log(combine('combine', 'improved!', ' is '));
}