-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I understand that searchString is not accepted in RegExp. (TypeError exception)
Throwing an exception if the first argument is a RegExp is specified in order to allow future editions to define extensions that allow such argument values.
But it does accept Array and Object through the method toString under the specification.
which are
// array
['this', 'is', 'an', 'array'].toString(); // => 'this,is,an,array'
// object
({'obj': 'obj'}).toString(); // => '[object Object]'Therefore, I would like to add more test cases
// array
assertEquals('this,is,an,array').includes(['this', 'is']), true);
assertEquals('this,is,an,array').includes(['this', 'is'], 1), false);
assertEquals('this, is, an, array').includes(['this', 'is']), false);
// object
assertEquals(String.prototype.includes.apply({ 'toString': function () { return '[object Object]'; }}, [{'obj': 'obj'}, 0]), true);It’s weird if someone input the array or object to the method includes, but it does support.
Metadata
Metadata
Assignees
Labels
No labels