Skip to content

Commit 47aff0c

Browse files
committed
Standardize style and fix typos and broken link
1 parent 4f07152 commit 47aff0c

File tree

1 file changed

+19
-28
lines changed

1 file changed

+19
-28
lines changed

README.md

Lines changed: 19 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Variables Lab
22

33
## Objectives
4-
- Practice using the `const` and `let` variables in JavaScript
4+
1. Practice using the `const` and `let` variables in JavaScript
55

66
## Instructions
7-
Ok, so this is your first lab. You'll notice a few new things in this lesson that we haven't encountered before. Don't worry, we'll walk you through them.
7+
Ok, so this is your first lab. You'll notice a few new things in this lesson that we haven't encountered before. Don't worry, we'll walk you through them.
88

99
### Tests...
10-
The first new thing you'll notice is tests. When we want to run an experiment, we need to develop a hypothesis and we need to test it. In programming, we run tests serve as our experiment to verify that programs behave the way we think they do. Tests help us identify bugs, and they give us a sense of the health of our applications.
10+
The first new thing you'll notice is tests. When we want to run an experiment, we need to develop a hypothesis and we need to test it. In programming, we run tests serve as our experiment to verify that programs behave the way we think they do. Tests help us identify bugs, and they give us a sense of the health of our applications.
1111

1212
Here, we use tests as teaching tools. Just like in a normal coding environment, we use tests to describe the program's behavior. You are in charge of getting the tests to pass.
1313

@@ -27,7 +27,7 @@ The structure of this lab — where its files and folders are located — looks
2727
All labs will more or less have the same structure. (And READMEs, for that matter, will still have CONTRIBUTING.md, LICENSE.md, and README.md files.)
2828

2929
### Code-along
30-
For now, open up `index.js` in your text editor. If you're using the Learn IDE, click the "Open" button in the top right hand corner of the lesson. If you open up that "js-basic-variables-lab" folder, you'll see a list of files (along with a test/ directory). Click `index.js`, and it will open in the editor.
30+
For now, open up `index.js` in your text editor. If you're using the Learn IDE, click the "Open" button in the top right hand corner of the lesson. If you open up that "js-basic-variables-lab" folder, you'll see a list of files (along with a test/ directory). Click `index.js`, and it will open in the editor.
3131

3232
In `index.js`, you should see, well, nothing. We'll fix that soon.
3333

@@ -42,61 +42,52 @@ describe('index.js', function () {
4242
});
4343
```
4444

45-
`describe` is a function provided by our test library, Mocha. The word is basically used to hold our tests. You can see that after the word `describe` is a description about our tests. Tests are used as a way to document the behavior of a function to developers, and you can see that examples of that after the words `describe`. For example, the next word `describe` is followed by the word `companyName` name. Here the test is telling us that the tests that come after words will be about `companyName`. Then comes the word `it`, where you see the following:
46-
45+
`describe` is a function provided by our test library, Mocha. The word is basically used to hold our tests. You can see that after the word `describe` is a description about our tests. Tests are used as a way to document the behavior of a function to developers, and you can see that examples of that after the words `describe`. For example, the next word `describe` is followed by the word `companyName` name. Here the test is telling us that the tests that come after words will be about `companyName`. Then comes the word `it`, where you see the following:
4746
```js
4847
it('is set as Scuber', function () {
4948
// tests are here
5049
});
5150
```
5251

53-
So this is telling us that the `companyName` should be set to `Scuber`. Finally, filling in the missing part of the `it` code, we see:
54-
52+
So this is telling us that the `companyName` should be set to `Scuber`. Finally, filling in the missing part of the `it` code, we see:
5553
```js
5654
it('is set as Scuber', function () {
5755
expect(companyName).to.equal('Scuber');
5856
});
5957
```
6058

61-
Here, we can see that it expects `companyName` to equal `Scuber`. That `expect` and `to.equal` are essentially doing the same thing as `companyName == 'Scuber'`. In other words, `expect(companyName).to.equal('Scuber')` is running code that will have this first test pass if `companyName` equals `Scuber` and fail if it does not.
62-
63-
Don't worry too much yet if it's hard to understand what is happening inside of the `test/indexTest.js` file. But it's a good idea to open up the file, and gather the information that you can. We will also provide Instructions in the `Readme.md` file that will allow you to complete the lab (as we do in this lab below).
59+
Here, we can see that it expects `companyName` to equal `Scuber`. That `expect` and `to.equal` are essentially doing the same thing as `companyName == 'Scuber'`. In other words, `expect(companyName).to.equal('Scuber')` is running code that will have this first test pass if `companyName` equals `Scuber` and fail if it does not.
6460

65-
## Running the Tests
61+
Don't worry too much yet if it's hard to understand what is happening inside of the `test/indexTest.js` file. But it's a good idea to open up the file, and gather the information that you can. We will also provide Instructions in the `Readme.md` file that will allow you to complete the lab (as we do in this lab below).
6662

63+
## Running the tests
6764
To run the tests, simply type `learn` in the terminal part of the Learn IDE. (The terminal is the part below where you've been coding.)
6865

69-
Running the `learn` command will open up a new tab on your browser, showing the current status of the tests. For the moment, all of the tests fail. Let's figure out how to get one of them passing! (The rest will be up to you.)
66+
Running the `learn` command will open up a new tab on your browser, showing the current status of the tests. For the moment, all of the tests fail. Let's figure out how to get one of them passing! (The rest will be up to you.)
7067

7168
To get our first test to pass, we can open up our `index.js` file, and write the following:
72-
7369
```js
7470
let companyName = 'Scuber';
7571
```
7672

77-
Great, our first test is now passing. Except the second test is also about `companyName` and it is not. It's not passing because, it expects a change to `companyName` to throw a `TypeError`. It sounds like it wants `companyName` to be declared using a different keyword than the `let` keyword - it needs a keyword that is used for variables that can't be changed...
78-
79-
Ok, so we'll let you work through the problems below. But in summary here is your workflow for a lab:
73+
Great, our first test is now passing. Except the second test is also about `companyName` and it is not. It's not passing because, it expects a change to `companyName` to throw a `TypeError`. It sounds like it wants `companyName` to be declared using a different keyword than the `let` keyword - it needs a keyword that is used for variables that can't be changed...
8074

75+
Ok, so we'll let you work through the problems below. But in summary here is your workflow for a lab:
8176
1. Run `learn`.
8277
2. Read the errors; vocalize what they're asking you to do.
8378
3. Write code; repeat steps 1 and 2 often until a test passes.
8479
4. Repeat as needed for further tests.
8580
5. Run `learn submit` when finished!
8681

87-
## Working Through The Problems
88-
If you open up `test/indexTest.js`, you will see the tasks in front of you.
89-
90-
+ `companyName` - Inside the `test/indexTest`, 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 afterwords, 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.
91-
92-
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 are confusing. Just know that the code attempts to change `companyName` to a different value, and that this reassignment to throw an error. So you need to make sure that you are using the correct variable type such that reassigning the variable would throw an error.
93-
94-
+ `mostProfitableNeighborhood` - Here we need to declare another variable, `mostProfitableNeighborhood` and assign it to `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 variable type such that reassigning the `mostProfitableNeighborhood` would not throw an error.
95-
96-
+ `companyCeo` - Here, we are getting more practice with declaring variables. Once again, a reassignment should not throw an error.
82+
## Working through the problems
83+
If you open up `test/indexTest.js`, you will see the tasks in front of you:
84+
+ `companyName` - Inside the `test/indexTest`, 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 afterwords, 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.
85+
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 are confusing. Just know that the code attempts to change `companyName` to a different value, and that this reassignment to throw an error. So you need to make sure that you are using the correct variable type such that reassigning the variable would throw an error.
86+
+ `mostProfitableNeighborhood` - Here we need to declare another variable, `mostProfitableNeighborhood` and assign it to `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 variable type such that reassigning the `mostProfitableNeighborhood` would not throw an error.
87+
+ `companyCeo` - Here, we are getting more practice with declaring variables. Once again, a reassignment should not throw an error.
9788

9889
## Resources
9990
- [MDN: Let](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/let)
10091
- [MDN: Const](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/const)
10192

102-
<p class='util--hide'>View <a href='https://learn.co/lessons/js-basic-variables-lab'>Javascript Variables Lab</a> on Learn.co and start learning to code for free.</p>
93+
<p class='util--hide'>View <a href='https://learn.co/lessons/js-basics-variables-lab'>Variables Lab</a> on Learn.co and start learning to code for free.</p>

0 commit comments

Comments
 (0)