Practice exercise - Boolean's & If,Else

I am trying to do th exercises for Practice exercise - Boolean’s & If,Else. I am in the console trying to write the script that is being asked for. I enter the first line but I am not able to add the second line without the fist line being executed which generates an error… How can i continue on tp to the next line of code without interruption?

2 Likes

Hello sir, I have moved your topic to the proper category, so the community can reach your questions easily.

If you have any more questions, please let us know so we can help you! :slightly_smiling_face:

Carlos Z.

Hi @shonesto Try Shift+Enter :slight_smile:

  1. What does the function parseInt() do?? This problem doesn’t seem to care if you omit that function and just call the prompt variable “age.” Why the parseInt() in the answer key?
1 Like
  1. Why is there a parseFloat() in the answer key on this one? What does that mean? I see they discuss parse in chapter 11 but I still don’t quite understand it

  2. What am I doing wrong?

parseFloat is an internal method of JavaScript to convert a number to float number type (float numbers are those who have decimals, like 11.3).

parseInt is the same but convert a number into Integer (no decimals, just fixed range like 11)

In your code you are calculating the amount of passengers incorrectly in terms of syntax.

console.log( "the bus is full, " + passengers + station - 30, " have to walk")

The operation should be inside ().

console.log( "the bus is full, " + (passengers + station - 30), " have to walk")

If you have any more questions, please let us know so we can help you! :slight_smile:

Carlos Z.

1 Like