Here is a link to this week’s tutorial exercises.
Use the code insert tool and provide examples to answer these two questions. Use JS comment syntax to describe your example.
- How can you use “falsey-ness” to determine if a string value can be coerced to a number? Why does this work? What is “type coercion” anyway?
Falsey-ness can be used to test if a value is true or not in the developer console. Type coercion is for coercing a number to a string and a string to a number.
!Number(str) //to test if it's a number Falsy Values false "" null undefined NaN
- What do you need to do to convert a
forloop to a
You have to initialize the
while loop outside of the
for loop and increment it inside of the
while loop. You can declare that before setting the condition.