问题
I am getting the error in the question mark. Here is the code
var isParallelStage = ($("#workflowStagesList .workflowStageListItemActive").find("p").text() === "P") ? true : false;
Error:
JSLint : Expected '!!' and instead saw '?'.
回答1:
? true : false
is an antipattern - it's totally useless, an identity function, you can simply omit it, you've already got a boolean. And if you didn't, you should use !!
or Boolean(…)
to cast your value to a boolean.
来源:https://stackoverflow.com/questions/36770789/jslint-expected-and-instead-saw