You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -11,6 +11,8 @@ JavaScript Arithmetic Lab
11
11
12
12
In this lab, we're going to practice writing functions and manipulating numbers in JavaScript. First, though, we need to go over some basic math. In this lab, we're going to learn about various arithmetic operators. What's an operator, you say? It's a symbol that _operates_ on one or more (usually two) objects — `+` is a good example. The `+` operator says "add what's to the left of `+` and what's to the right of `+` together." Easy-peasy!
13
13
14
+
As you read through this lesson, you're going to be adding your solutions to `index.js`. You'll write a total of eight functions; use the results of running `learn test` in your IDE to guide you towards the right function names and functionality.
15
+
14
16
## Basic Math
15
17
16
18
The most fundamental math operations work as one might expect in JavaScript: `+` adds two numbers; `-` subtracts one number from another; `*` multiplies two numbers; and `/` divides one number by another. For example (as usual, follow along in console!)
@@ -22,7 +24,7 @@ The most fundamental math operations work as one might expect in JavaScript: `+`
22
24
5.0/2.5// 2
23
25
```
24
26
25
-
At this point, we can fix the first few broken tests: we can define functions `add()`, `subtract()`, `multiply()`, `divide()` in `index.js`.
27
+
At this point, we can fix the first _four_ broken tests: we can define functions `add()`, `subtract()`, `multiply()`, `divide()` in `index.js`.
26
28
27
29
## Math + Assignment
28
30
@@ -111,7 +113,7 @@ console.log(number) // 5
111
113
112
114
**Because these methods are more explicit, prefer `+=` to `++` and `-=` to `--` (usually).**
113
115
114
-
Okay, now we're ready to write solutions for `inc(n)` and `dec(n)`.
116
+
Okay, now we're ready to write solutions for the next two functions: `inc(n)` and `dec(n)`.
115
117
116
118
## Parsing Numbers
117
119
@@ -155,7 +157,8 @@ Unlike `parseInt()`, `parseFloat()` accepts only a single argument, the thing to
155
157
parseFloat('80.123999') // 80.123999
156
158
```
157
159
158
-
You're now ready to solve the final tests in this lab, `makeInt(n)` and `preserveDecimal(n)`.
160
+
You're now ready to solve the final two tests in this lab, `makeInt(n)` and `preserveDecimal(n)`.
0 commit comments