direct equality vs Array.prototype.includes

Edit on GitHub

Determine which is faster: Array.includes(val) or comparing the same var twice.

Setup

var myVar = 5;
var myList = [4,5];

Tests

  • direct equality

    myVar === 5 && myVar !== 3
  • Array.prototype.includes

    myList.includes(myVar)