Skip to content
This repository was archived by the owner on Oct 11, 2024. It is now read-only.

Commit e7d7027

Browse files
committed
Updated README.md
1 parent 1b4a827 commit e7d7027

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ The first two lines first print the String `"Name:"`, then it prints the _value
3434

3535
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.
3636

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
3838
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
3939

4040
```javascript
4141
var height = 74
4242
```
4343

4444
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+
<p class='util--hide'>View <a href='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

Comments
 (0)