Edwin Reynoso wrote:
There are times where I would like to check whether a string has every
occurrence of certain strings/numbers:
Now to achieve what I would like `String.prototype.includes` to
accomplish
with an array as the first parameter, I currently take the following
approach:
Well the current ES6 `.includes()` was before named `.contains()`:
[String.prototype.includes] (
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#String.prototype.contains
)
But if Garrett Smith was trying to point out that `.contains()` would be
On 3/10/15, Edwin Reynoso eor...@gmail.com wrote:
Hi Edwin -
Well the current ES6 `.includes()` was before named `.contains()`:
[String.prototype.includes] (
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes#String.prototype.contains
)
But if
On 3/10/15, Garrett Smith dhtmlkitc...@gmail.com wrote:
On 3/10/15, Edwin Reynoso eor...@gmail.com wrote:
[...]
specs if I want to understand what I am doing in order to pay my rent.
It can and should suck less.
Let me rephrase that: I don't mean that the specification sucks -
sitting down
On 3/10/15, Andrea Giammarchi andrea.giammar...@gmail.com wrote:
I'm still having hard time understanding what's the difference between
contains and the good old indexOf beside the RegExp check ... but I agree
having multiple explicit searches instead of multiple implicit searches
won't make
I'm still having hard time understanding what's the difference between
contains and the good old indexOf beside the RegExp check ... but I agree
having multiple explicit searches instead of multiple implicit searches
won't make such big difference. Good news is, you probably will still use
RegExp
Would `new Set(arr.concat(substrings)).length === arr.length` work?
Personally I find the some approach the clearest, though.
On Tue, Mar 10, 2015 at 1:42 PM, Garrett Smith dhtmlkitc...@gmail.com
wrote:
On 3/10/15, Andrea Giammarchi andrea.giammar...@gmail.com wrote:
I'm still having hard
also, just for people not afraid of the tilde
`[Maria, Mariana].some(e=~a.indexOf(e));`
yeah, you can use it ^_^
On Tue, Mar 10, 2015 at 9:34 PM, Andrea Giammarchi
andrea.giammar...@gmail.com wrote:
contains better than indexOf ? I'd agree only if contains wasn't accepting
any extra
On 3/10/15, Andrea Giammarchi andrea.giammar...@gmail.com wrote:
contains better than indexOf ? I'd agree only if contains wasn't accepting
any extra argument, which makes it even more (pointless?) similar to
indexOf.
If it had only one incoming parameter, you could have `[maria,
not sure I understand what you say but `[maria,
marianne].some(str.contains,
str)` means `[maria, marianne].some(function (value) {return
this.contains(value)}, str)` ... no bind nor arrow function needed, the
function `str.contains` is executed with `str` as context per each
iteration. Is that
10 matches
Mail list logo