← Back

no-sparse-arrays warning

Disallows array literals with empty slots

Examples

❌  Incorrect

var items = [,];
var colors = [ "red",, "blue" ];

✅  Correct

var items = [];
var items = new Array(23);

// trailing comma (after the last element) is not a problem
var colors = [ "red", "blue", ];