0
votes

I'm checking out the documentation source file index.js from this library. I checked up the code in jshint, and there's a warning saying:

Expected an assignment or function call and instead saw an expression.

File: index.js Line: 215

s = (Math.sqrt((x * x) + (y * y)) / r) * 100;

Why am I getting the warning, and how can I fix it?

1
Is it because commas rather than semicolons separate that and the preceding lines? - Michael Liu
@Horay This link might help you better understand the intent of the message you received: jslinterrors.com/expected-an-assignment-or-function-call - Brian Driscoll

1 Answers

1
votes

Michael Liu is correct. At the jshint website, replacing the commas with semi-colons gets rid of the warning:

function main() {
  var currentTargetHeight = 240;
  var e = {clientX: 40, clientY: 50};
  var startPoint = { left: 3, right: 4};
  var r, x, y, h, s;
  r = currentTargetHeight / 2;
  x = e.clientX - startPoint.left - r;
  y = e.clientY - startPoint.top - r;
  h = 360 - ((Math.atan2(y, x) * 180 / Math.PI) + (y < 0 ? 360 : 0));
  s = (Math.sqrt((x * x) + (y * y)) / r) * 100;
}

main();