Tip #2: Avoid let statements Jan 14

Do not use let when only used for delayed initialization. Using let is a hint to developers, that variable will change over time so should be avoided if possible by restructuring initialization.

Avoid

let closeToLeft = false
let closeToRight = false
if (maxDepthPixelValue < 60) closeToLeft = true
if (maxDepthPixelValue > Utils.width - 60) closeToRight = true

Do

const closeToLeft = (maxDepthPixelValue < 60)
const closeToRight = (maxDepthPixelValue > Utils.width - 60)