← Back

no-var warning

Discourage using 'var' for creating variables - require using let/const instead

Examples

❌  Incorrect

var count = posts.length;

✅  Correct

const count1 = posts.length;

// or, if the value can be changed

let count2 = posts.length;

if (additionalPosts.length) {
   count2 += additionalPosts.length;
}