Skip to content

Latest commit

 

History

History
20 lines (12 loc) · 320 Bytes

prefer-includes.md

File metadata and controls

20 lines (12 loc) · 320 Bytes

Forces the use of Array.prototype.includes instead of indexOf()

Rule Details

The following pattern is considered a warning:

var users = [1, 2, 3, 4];

users.indexOf(2) == -1; //false

The following pattern is not considered a warning:

var users = [1, 2, 3, 4];

users.includes(2); // true