Files
codeql/javascript/ql/test/query-tests/Expressions/UnneededDefensiveProgramming/tst2.js
Asger F 7bd01bf039 JS: Bulk update in UnneededDefensiveProgramming test
The history of updates to this test got messed up so just squashing
into one commit.

Some possible regressions have been accepted, but the query is strangely
opinionated so it's just hard to say what it ought to flag.
2025-02-28 13:29:33 +01:00

19 lines
374 B
JavaScript

(function(){
var v;
(function(){
if(typeof v === "undefined"){ // $ Alert[js/unneeded-defensive-code]
v = 42;
}
for(var v in x){
}
});
});
const isFalsyObject = (v) => typeof v === 'undefined' && v !== undefined;
function f(v) {
if (typeof v === 'undefined' && v !== undefined) {
doSomething(v);
}
}