Hristo.V
Hristo.V

Reputation: 21

Expected an identifier and instead saw '*'. (E030) [jshint]

I'm making a function in which I need the square root of a number. The problem is that when I try to use the exponentiation operator "**" Visual Studio Code gives me the error:

"Expected an identifier and instead saw "*". (E030)"

The operation still works so I'm wondering why does it even give me an error. I compared it to the Math.pow function and it gives the same result.

let xDist= (x2-x1)**2;
let xDist= Math.pow ((x2-x1),2);

Upvotes: 2

Views: 2063

Answers (1)

Champ
Champ

Reputation: 1361

I think you are hitting the issue of jshint not supporting exponentiation operator yet! For now, you can ignore the line with a trailing comment like this:

let xDist= (x2-x1)**2; // jshint ignore:line

Refer: https://github.com/jshint/jshint/issues/2602

Upvotes: 2

Related Questions