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
+9-7Lines changed: 9 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,7 @@ One might think that we could just type
25
25
Hello, everybody!
26
26
```
27
27
28
-
in our browser's console and be done with it. Give it a try. (If you're on a Mac, that would be `Command` + `Option` + `J` together.)
28
+
in our browser's console and be done with it. Give it a try. (If you're on a Mac, that would be `Command` + `Option` + `J` together.)
29
29
30
30
You should see something like
31
31
@@ -74,15 +74,15 @@ This is called _interpolation_.
74
74
75
75
## Lab
76
76
77
-
You'll find a file called `strings.js` in this directory. Your mission, should you choose to accept it, is to get its tests (in `tests/strings-test.js`) to pass.
77
+
You'll find a file called `index.js` in this directory. Your mission, should you choose to accept it, is to get its tests (in `tests/index-test.js`) to pass.
78
78
79
79
You can run the tests using the `learn` command in your terminal or the Learn IDE. Give that a go now.
80
80
81
81

82
82
83
83
All three tests have failed! This is okay, and it's expected — you haven't written any code yet, after all.
84
84
85
-
In `strings.js`, you'll see four lines of code:
85
+
In `index.js`, you'll see four lines of code:
86
86
87
87
```javascript
88
88
var greeting ="!";
@@ -108,7 +108,9 @@ Let's walk through that first error together. First, we see the test title:
108
108
1) strings defines `greeting`:
109
109
```
110
110
111
-
The title tells us what the test expects our code to do. In this case, "strings" refers to the file that we've been working in, `strings.js` — it's common to refer to name files by what they contain, and makes reasoning about their names super easy.
111
+
The title tells us what the test expects our code to do. In this case,
112
+
"strings" refers to the general problem space in which we're working —
113
+
we're handling strings.
112
114
113
115
Continuing on with the test output, we can now make better sense of the next few lines:
114
116
@@ -129,9 +131,9 @@ What is that thing? The test expected the empty string, `''`, to be equal to the
129
131
130
132
But reading on, we only see `+Hello, everybody!` — what's going on? Why isn't there any `- actual` output? Well, there _was_ no actual output — it's just an empty string! That must be the problem!
131
133
132
-
Next, the title tells us that `strings.js` "defines `greeting`." Let's look in `strings.js` — sure enough, we see, at the top of the file, `var greeting = "";`. Seems like a reasonable place to start.
134
+
Next, the title tells us that `index.js` "defines `greeting`." Let's look in `index.js` — sure enough, we see, at the top of the file, `var greeting = "";`. Seems like a reasonable place to start.
133
135
134
-
What if, instead of assigning `""` to `greeting`, we assign `"Hello, everybody!"`, like the test expects. Go ahead and change that line in `strings.js` so it reads
136
+
What if, instead of assigning `""` to `greeting`, we assign `"Hello, everybody!"`, like the test expects. Go ahead and change that line in `index.js` so it reads
135
137
136
138
```javascript
137
139
var greeting ="Hello, everybody!";
@@ -143,7 +145,7 @@ save the file, and rerun your tests. You should see
143
145
144
146
Nice! You got the first test to pass.
145
147
146
-
Now use the skills that you learned above to read through the rest of the test output and fix those errors, too! Always remember to save your file before re-running your tests.
148
+
Now use the skills that you learned above to read through the rest of the test output and fix those errors, too! Always remember to save your file before re-running your tests.
147
149
148
150
**NOTE**: Because we're dealing with some low-level language features, you might spot some easy ways to "cheat" on this lab, or this lab might seem frustratingly easy. We've given you some starter code to point you in the right direction — try to solve the lab as intended! You can then compare your solution with ours (found in the `solution` branch of this repository).
0 commit comments