Josh glantz - #1
Conversation
christopherjbaker
left a comment
There was a problem hiding this comment.
Pretty good! only a few mistakes. Several places with spacing irregularity, but you picked that up pretty quickly for CSS, so I think you will here too.
|
|
||
| //Task c: Convert string ("1999") to integer (1999) (no function required) // hint look up the Number method | ||
|
|
||
| console.log(parseInt("1999")); |
There was a problem hiding this comment.
This is the correct way to do it. Good practice is to always include the radix (the base of the input number, in this case 10). console.log(parseInt("1999", 10)); (similarly, you can use this to parse hexadecimal (16) binary (8) etc).
The method they were looking for is console.log(Number("1999"));. Though this works, there are some reasons (constructors, which you haven't learned yet) why this is a potentially very confusing way.
There are other ways when performance is important, but no need to confuse the issue yet. =P
| console.log("I am " + ageInDogYears + " in dog years."); | ||
| } | ||
| ageConverter(32); | ||
| // returning undefined for some reason... grrr |
There was a problem hiding this comment.
Because you didn't return anything. You logged it to the output but didn't return anything.
| feed = weight * .04; | ||
| } else if ( 10 < weight && weight <= 15 ) { | ||
| feed = weight * .03; | ||
| } else if ( weight < 15 ) { |
| } | ||
| console.log("Feed Me " + feed + " pounds of raw food a day"); | ||
| } | ||
| dogFeeder(1, 15); |
There was a problem hiding this comment.
Other than the 1 error, this works. It could be easier to understand though, and there's some extraneous logic.
| } | ||
| console.log("Player " + result ); | ||
| } | ||
| rockPaperScissors("spock"); |
|
|
||
|
|
||
| // sytax expanded bc it was frying my brain... | ||
| // 99% sure there's a more elegant solution in here. Excited to find it later. |
There was a problem hiding this comment.
There is always a more elegant solution. There will usually be various trade-offs between them. Here, you've fully expanded the logic, which is much easier to follow manually but leaves more room for errors. Others might be shorter or more elegant or optimized, but be more difficult to understand easily.
| } | ||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
Gettig there. Few bits missing.
I finished the MVP on time, but spent too long working on the stretch, which is why I'm PR'ing & submitting late.
I'm going to submit & do a pull request as soon as I finish the MVP for now, to prevent a "late submission".
Stretch 1 is a work in progress, with my notes in it.