Basic JavaScript - Divide One Decimal by Another with JavaScript

Tell us what’s happening:
Describe your issue in detail here.

When i try to catch the resulted value of quotient using console, gets following error.

The quotient variable should only be assigned once

NOTE: Code runs successfully, and resulted quotient value is also showing on the terminal.

const quotient = 4.4 / 2.0; // Change this line

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: Basic JavaScript - Divide One Decimal by Another with JavaScript

Link to the challenge:

Don’t add the console.log.

It’s not really an error, but the third unit test is failing. My guess is that the unit test is just checking for the quotient variable exists on any other line besides the one that says “Change this line” comment.

Since you’re only supposed to change that one line of code, you’re technically not following directions by adding that console.log(). Instead, maybe the unit test should be “only change the 1st line of code” and auto fail if the script has more than one line? Either way… just don’t add the console.log() - that’s the simplest solution. It’s not needed.

HI @komalbhatia2305 !

Welcome to the forum!

As was mentioned earlier, the test here was only looking for one mention of quotient but you added it twice because of the console.log.

But I don’t want this to discourage you from using console.log in other challenges because that is important for learning and debugging and most tests won’t care. It is just this test had an issue with it :+1:

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.