How to fix the problem? Validator swears

const newLeft = e.pageX - shiftX - sliderCoords.left; if (newLeft < 0) { newLeft = 0; } const rightEdge = sliderElem.offsetWidth - thumbElem.offsetWidth; if (newLeft > rightEdge) { newLeft = rightEdge; } 

Mistake:

Module build failed: Error: SyntaxError: "newLeft" is read-only

Closed due to the fact that off-topic participants are user194374, Denis , aleksandr barakin , Alexey Shimansky , Denis Bubnov 21 Dec '16 at 6:13 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • "The question is caused by a problem that is no longer reproduced or typed . Although similar questions may be relevant on this site, solving this question is unlikely to help future visitors. You can usually avoid similar questions by writing and researching a minimum program to reproduce the problem before publishing the question. " - Community spirit, Denis, aleksandr barakin, Alexey Shimansky, Denis Bubnov
If the question can be reformulated according to the rules set out in the certificate , edit it .

    1 answer 1

    A constant is a type that can be assigned once and read.
    You are trying to change the value of a constant, but you cannot do this. Declare newLeft via var

    • For sure! Thank you, simply debazhil, and did not notice at all. Shame on you: \ - Atomrr
    • It happens to everyone. Accept my answer if the issue is resolved. - ilyaplot
    • one
      Yes, of course, I will take as it will be 6 minutes. Previously not allowed - Atomrr