BananaMaster

3 - Type Coercion in JavaScript | JS lessons

If you forgot something — click to go to the lesson.

For each expression, determine the value and type of the result.

Task 1. tricky example

'' + 1 + 0 — value and type?

Task 2. tricky example

'' - 1 + 0 — value and type?

Task 3.

4 / '2' — value and type?

Task 4.

'2' * '4' — value and type?

Task 5. tricky example

4 + 5 + 'px' — value and type?

Task 6. tricky example

'$' + 1 + 2 — value and type?

Task 7.

'4' - 2 — value and type?

Task 8.

'2px' - 2 — value and type?

Task 9.

' -9 ' + 5 — value and type?

Task 10.

' -9 ' - 5 — value and type?

Task 11. tricky example

2 + 2 + '1' — value and type?

Task 12.

'5px' - '5px' — value and type?