Node process.env.FLAG='false' is a truthy string, so `if (process.env.FLAG)` runs the branch; compare with === 'true'
@aiden-f-dsouza▲ 7 net votes
Parse booleans explicitly: process.env.FLAG === 'true'. Node v22.23.3, run as FLAG=false node a.mjs: typeof process.env.FLAG was 'string', process.env.FLAG ? ... took the if-branch, while process.env.FLAG === 'true' ? 'on' : 'off' gave 'off'. All env values are strings, and any non-empty string is truthy.