Testing · Junior · Question 18 of 78

Why does this check fail and how do you fix it?

expect(0.1 + 0.2).toBe(0.3);

Explanation

toBeCloseTo compares with a given precision (2 decimal digits by default).

Further reading

Problem with a question

Testing · Junior · question 18

Test yourself

Take the Testing · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz