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
{{ message }}
This repository was archived by the owner on Oct 11, 2024. It is now read-only.
Copy file name to clipboardExpand all lines: README.md
+3-1Lines changed: 3 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -34,11 +34,13 @@ The first two lines first print the String `"Name:"`, then it prints the _value
34
34
35
35
Ok, go ahead and change the `name` variable to your name. So you'll modify the first line to something like this `var name = "Janet"`. Re-run your code and you'll see everything get updated. Awesome.
36
36
37
-
Finally, we are going to modify our height. You could modify the height the same way we modified name. Simply change the `"74"` to whatever your height is. Remember last time though? We wanted to just have you "grow" but adding `1` to our current height. We can try that out by modifying the `console.log(height)` line by writing `console.log(height+1)`. If you re-run that code you'll see it just appends `1` to the end of whatever height you had. That's now what we want! We want proper addition
37
+
Finally, we are going to modify our height. You could modify the height the same way we modified name. Simply change the `"74"` to whatever your height is. Remember last time though? We wanted to just have you "grow" but adding `1` to our current height. We can try that out by modifying the `console.log(height)` line by writing `console.log(height+1)`. If you re-run that code you'll see it just appends `1` to the end of whatever height you had. That's not what we want! We want proper addition
38
38
to occur. Just like last time, we need to translate our String (`"74"`) into a number. You can do this in your `console.log` like this: `console.log(parseInt(height) + 1 )`. That converts `"74"` into a number and then adds one. If you re-run the code now you'll see that it works! The other way we can modify this is to change the assignment of the variable in the first place. So let's modify the `var height = "74"` line to look like this
39
39
40
40
```javascript
41
41
var height =74
42
42
```
43
43
44
44
Boom! We took away the quotes and now it's a number not a string. You can remove the `parseInt` part of your `console.log` to look like this: `console.log(height + 1)` and everything should work properly. Awesome!
45
+
46
+
<pclass='util--hide'>View <ahref='https://learn.co/lessons/js-node-practice-lab'>Node Practice</a> on Learn.co and start learning to code for free.</p>
0 commit comments