I came across this polyfill Array.prototype.includes. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/includes . Is there a reason for comparing variables with themselves on line 21.22?
if (searchElement === currentElement || (searchElement !== searchElement && currentElement !== currentElement)) { return true; }
Yes, this second operand || checks if searchElement and currentElement NaN - a value in JavaScript that is not === for itself. It is assumed that includes uses the SameValueZero equivalence SameValueZero , which is different from the Strict equality comparison algorithm ( === used) or the SameValue algorithm (used in Object.is ).
||
searchElement
currentElement
NaN
===
includes
SameValueZero
SameValue
Object.is
Source: https://habr.com/ru/post/978714/More articles:Android RatingBar as a button when isIndicator = True - androidHaving some basic features on Go - goShakespeare assignment variables not working - compiler-errorsNode.js build json api for geroku - jsonJava Unsupported major.minor version 52.0 error Minecraft - javaFormat tooltips in Highcharts - javascriptMerge columns in Pandas DataFrame with column lists in DataFrame - pythonSASS: How to remove / * # sourceMappingURL Comment - commentsDynamic selection of multiple tabs in a brilliant application - javascriptBlack voodoo from NumPy Einsum - pythonAll Articles