The for loop pattern is one.

Bertotti: I haven’t really read about them yet, but if I am targeting ES6 I might find it better to rewrite some of this stuff using cl***es

Andalora: Deltab: thank you again

Gentleman: Purebe: i don’t really agree, JS doesn’t have cl***es.

Quaresma: I was under the impression ES6 added them?

Leverenz: Only syntax sugar for the prototype stuff

Moua: What’s the point then?

Gentleman: Purebe: the “cl***” keyword isn’t cl***es

Gentleman: It’s sugar over normal prototypical inheritance. which isn’t cl***es.

Bora: Well that seems unfortunate. I’m not a big fan of the current inheritance in jS

Gentleman: Inheritance ****s anyways.

Mate: Purebe: Cl*** hierarchies? Don’t do that!***-hierarchies-dont-do-that.html See also, !inheritance

Chitrik: Yeah I’m with you on that

Bertsche: Hey guys, I’m writing a backbone app and I’d like my views to trigger filters on models of various types. I’d like the views to be agnostic as to the type of model, so for them to trigger a filter of, say, “date 2015 and date 2013” I have to send that conditional in some data source agnostic way. Is there a best practice around this? Like a standard query object structure?

Gentleman: Timwis: nope, you’d have to make something up.

Clagon: Knex.js seems a bit overkill and doesn’t seem to let you access the pieces

Raczak: I feel like I’d basically be writing an AST structure

Ditter: Hi! at this link the bottom answer warns that for var i in array{ please use hasOwnProperty with this, for caution. why and how to do this?

Gentleman: Dirgeable: don’t use ever, but especially not with arrays.

Gentleman: Dirgeable: iterates over the entire prototype chain, which isn’t what you want. use Object.keys for objects, and .forEach or .map etc for arrays.

Dunworth: Gentleman, foreach, thanks!

Mate: Dirgeable: Array.prototype.forEach – JavaScript MDN

Obermoeller: Looping over arrays/objects is the only reason I using lodash

Mcgloster: I don’t mind normal for loops for arrays

Gentleman: Iterations aren’t loops.

Gentleman: And loops are never needed.

Gentleman: And most of the things lodash/underscore does with arrays are built into the language already :-

Mcclellan: Why would you prefer forEach to for, when dealing with an array?

Eggimann: Timwis: there are some databases with JSON-based query syntax that you could borrow from, or check out the links at the bottom of

Mate: Purebe: Instead of using for or while loop constructs to iterate over arrays, consider using array iteration methods i.e., forEach, every, some, filter, map, reduce, reduceRight, or a combination thereof. They relieve the need for manual iteration, provide better abstraction, and make it clear what your iteration is doing.

Gentleman: Purebe: because i’m not stuck in the 60s, and i like to use more modern tools once they’ve evolved.

Koenning: It’s slower and I’m not sure I see how it does any of those last three things

Gentleman: The real question is why would you ever prefer a for loo

Gentleman: A it’s not much “slower”, b “slower” never matters

Gentleman: ForEach/map/etc is you telling the computer what you want done. a loop is you telling the computer how to do it.

Gentleman: The computer is smarter than you – tell it what you want.

Gentleman: Also it makes your code more readable.

Masingale: How could it possibly make the code more readable?

Gentleman: Like, by an immeasurably large amount

Gaulzetti: The for loop pattern is one of the first things you learn