"unexpected console statement no-console"

Segal Pal picture Segal Pal · Jun 1, 2019 · Viewed 12k times · Source

I'm getting this error in Brackets.

I want to stress the fact that it's literally the second time I opened a JS file. As I stressed It I want also to emphasize the fact that I have no clue what Eslint and node.js are.

All the fixes on the StackOverflow and other sites assume knowing how abovementioned entities work.

Please help to a complete newb to fix the problem and learn something new.

Thank you in advance!

Here's the piece of code, but I don't think it will help with anything.

Html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JavaScript</title>

</head>
<body>
<h1>Javascript starter</h1>

    <script src=Script.js> </script>
</body>
</html>

Javascript:

var now = 2018;
var yearJohn = 1989;
var fullAge = 18;

//Multiple operators
var isFullAge = now - yearJohn >= fullAge; //true
сonsole.log(isFullAge);

//Grouping

    var ageJohn = now - yearJohn;
    var ageMark = 35;
    var average = (ageJohn + ageMark)/2;
    console.log(average);

    // Multiple assigments
    var x, y;
    x = y = (3 + 5) * 4 - 6; // 8 * 4 - 6 // 32 - 6 // 26

    console.log(x, y);

    // More operators
    x *= 2;
    console.log(x);
    x += 10;
    // eslint-disable-next-line no-console
    console.log(x);

Answer

Dr_Derp picture Dr_Derp · Jun 1, 2019

If it really is ESLint that is causing errors for this change, you can fix it by disabling the rule for that particular line:

// eslint-disable-next-line no-console
console.log(isFullAge);