gpt4 book ai didi

javascript - 警告 : Expected an assignment or function call and instead saw an expression

转载 作者:行者123 更新时间:2023-12-03 08:00:13 36 4
gpt4 key购买 nike

我正在查看文档源文件 index.js来自this library 。我检查了jshint中的代码,有一个警告说:

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

文件:index.js Line: 215

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

为什么我会收到警告,该如何解决?

最佳答案

迈克尔刘是正确的。在the jshint website ,用分号替换逗号可以消除警告:

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();

关于javascript - 警告 : Expected an assignment or function call and instead saw an expression,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34619946/

36 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com