I was going to suggest a Set, now that ECMA has them…
http://www.ecma-international.org/ecma-262/6.0/index.html#sec-set-objects
```js
if ((new Set([1,2,3,5]).has(a)) {
// stuff
}
```
On Sun, Aug 9, 2015 at 4:20 PM myemailu...@gmail.com wrote:
it could be used like this:
if ( a == 1
();
finally cleanUp();
in the same spirit as
if (foo) doFoo();
else doBar();
-Michael A. Smith
On Wed, Apr 18, 2012 at 5:45 AM, Jussi Kalliokoski
jussi.kallioko...@gmail.com wrote:
Silent catch-alls like that are almost always bad code. I think the
language rather shouldn't encourage
+1 on clear() as it's pithy, understandable, and behaves the same in
Java and Python.
What real benefit comes from drawing this connection between delete()
and deleteAll()? I suspect the everyday programmer won't care, and the
ones who do will look it up.
-Michael A. Smith
On Wed, Feb 15, 2012
requires two constructions, one of which is
essentially a waste. If allowing both forms of the constructor is
distasteful, then why not just go with the multiple parameters,
approach, and implement toSet() as a method on appropriate Iterables?
-Michael A. Smith
On Sun, Feb 12, 2012 at 9:29 PM
Sorry for the resend. Meant to include the list.
I like this idea a lot! However, what would be the correct behavior of
a method like 'every' on an infinite generator?
-Michael A. Smith
On Fri, Feb 3, 2012 at 3:54 PM, Domenic Denicola
dome...@domenicdenicola.com wrote:
ES5's existing array
of such
methods. Something like
someVeryLargeArray.iMap(someFunction); // Lazy, guaranteed only to be iterable
(No apologies to the email protocol.)
What do you think?
-Michael A. Smith
On Fri, Feb 3, 2012 at 3:54 PM, Domenic Denicola
dome...@domenicdenicola.com wrote:
iterator.map(mapper).some
.)
Michael A. Smith
Web Developer
True Action Network, an eBay Company
On Tue, Jan 3, 2012 at 1:12 PM, Rick Waldron waldron.r...@gmail.com wrote:
On Tue, Jan 3, 2012 at 12:50 PM, Sean Eagan seaneag...@gmail.com wrote:
I think step should be 0, and step towards end:
Array.range({start: 5, end: 0
the starting index?
String.prototype.until = function (start, needle) {
return + (this.substr(start, this.indexOf(needle)) || this);
}
(The [ +] part is probably not necessary, but it makes it easier to
see the implementation work in the console.)
Michael A. Smith
Web Developer
True Action
sense…
Is the difference in overhead between instantiating a new array and
using Array.prototype.slice.call on arguments really worth sacrificing
consistency with the proposed string.prototype.repeat and the very
clean syntax of someArray.repeat(n)?
Michael A. Smith
Web Developer
True Action
9 matches
Mail list logo