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
+20-21Lines changed: 20 additions & 21 deletions
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
## Problem Statement
4
4
5
-
We've covered a lot of JavaScript concepts, but now it's time to put the concepts in to practice. We'll start with variables.
5
+
We've covered a lot of JavaScript concepts, but now it's time to put the concepts into practice. We'll start with variables.
6
6
7
7
## Objectives
8
8
@@ -26,8 +26,8 @@ in charge of getting the tests to pass.
26
26
27
27
### Structure
28
28
29
-
The structure of this lab — where its files and folders are located — looks
30
-
roughly like the following:
29
+
The structure of this lab — where its files and folders are located
30
+
— looks roughly like the following:
31
31
32
32
```
33
33
├── CONTRIBUTING.md
@@ -101,12 +101,11 @@ gather the information that you can. We will also provide instructions in the
101
101
102
102
## Running the Tests
103
103
104
-
To run the tests, type `learn` in the terminal part of the Learn IDE.
105
-
(The terminal is the part below where you've been coding.)
106
-
107
-
Running the `learn` command will open up a new tab on your browser, showing the
108
-
current status of the tests. For the moment, all of the tests fail. Let's figure
109
-
out how to get one of them passing! (The rest will be up to you.)
104
+
To run the tests, type `learn` or `learn test` in the terminal. (If you're using
105
+
the IDE, the terminal is the part below where you've been coding.) You should
106
+
now see the current status of the tests in the terminal. For the moment, all of
107
+
the tests fail. Let's figure out how to get one of them passing! (The rest will
108
+
be up to you.)
110
109
111
110
To get our first test to pass, we can open up our `index.js` file, and write the
112
111
following:
@@ -115,11 +114,11 @@ following:
115
114
let companyName ='Scuber';
116
115
```
117
116
118
-
Great, our first test is now passing. However, the second test that is also about
119
-
`companyName` is not yet passing. It's not passing because, it expects a change to
120
-
`companyName` to throw a `TypeError`. It sounds like it wants`companyName` to
121
-
be declared using a different keyword than the `let` keyword - it needs a
122
-
keyword that is used for variables that can't be changed...
117
+
If you run `learn` again, you'll see that our first test is now passing.
118
+
However, the second test, which is also about `companyName`, is not yet passing.
119
+
It's not passing because it expects`companyName` to be declared using a
120
+
different keyword than the `let` keyword — it needs a keyword that is used
121
+
for variables that can't be changed...
123
122
124
123
Continue to work through the problems below. Keep in mind the general workflow
125
124
for a lab:
@@ -128,18 +127,18 @@ for a lab:
128
127
2. Read the errors; vocalize what they're asking you to do.
129
128
3. Write code; repeat steps 1 and 2 often until a test passes.
130
129
4. Repeat as needed for further tests.
131
-
5.Run`learn submit` when finished!
130
+
5.Unless you're working in Canvas, run`learn submit` when finished!
132
131
133
132
## Working Through the Problems
134
133
135
134
If you open up `test/indexTest.js`, you will see the tasks in front of you:
136
135
137
-
+`companyName` - Inside the `test/indexTest.js` file, look inside of the word `describe` where the tests are trying to indicate that this test is describing the `companyName` variable. The `it` word that comes afterwards, tells us the features of `companyName`. In the first `it` function call, it says that `it` (companyName) `is set as Scuber`. In the next line, you can see that the test checks to make sure this occurs by seeing if `companyName` equals `Scuber`. So this means that you need to go to your `index.js` file and declare a variable named `companyName` and set it equal to `Scuber`. Once you do that, if`learn`is running, you will see the first test in this lab as passing.
138
-
+ In the next `it` function call, we are still describing `companyName`. This time, it says it `raises error if the companyName is changed`. The next line of code tests this. It's ok if some of the code in that line is confusing. Just know that the code attempts to change `companyName` to a different value, and that this reassignment should throw an error. So you need to make sure that you are using the correct type of variable declaration such that attempting to reassign the variable throws an error.
139
-
+`mostProfitableNeighborhood` - Here we need to declare another variable, `mostProfitableNeighborhood` and assign to it the string `'Chelsea'`. In the next `it` function call, you can see that our tests ensure that `mostProfitableNeighborhood` does not throw an error when reassigned. So you need to make sure that you are using the correct type of variable declaration such that assigning a new value to `mostProfitableNeighborhood` doesn't throw an error.
140
-
+`companyCeo` - Here, we are getting more practice with declaring variables. Once again, a reassignment should not throw an error.
136
+
+`companyName` - Inside the `test/indexTest.js` file, look inside of the word `describe` where the tests are trying to indicate that this test is describing the `companyName` variable. The `it` word that comes afterwards, tells us the features of `companyName`. In the first `it` function call, it says that `it` (companyName) `is set as Scuber`. In the next line, you can see that the test checks to make sure this occurs by seeing if `companyName` equals `Scuber`. So this means that you need to go to your `index.js` file and declare a variable named `companyName` and set it equal to `Scuber`. Once you do that, run`learn`and you will see the first test in this lab is passing.
137
+
+ In the next `it` function call, we are still describing `companyName`. This time, it says it `is defined as a const`. The next line of code tests this. So you need to make sure that you are using the correct type of variable declaration such that attempting to reassign the variable throws an error.
138
+
+`mostProfitableNeighborhood` - Here we need to declare another variable, `mostProfitableNeighborhood` and assign to it the string `'Chelsea'`. In the next `it` function call, you can see that you need to make sure that you are using the correct type of variable declaration such that assigning a new value to `mostProfitableNeighborhood` doesn't throw an error.
139
+
+`companyCeo` - Here, we are getting more practice with declaring variables. Once again, we want to use a variable declaration that allows reassignment.
0 commit comments