Joined March 2012

Farid Nouri Neshat

Sofware Engineer at OlinData
Sofware Engineer

There's also sails.js:

Quite good when you want rest APIs plus connected to a DB.

Posted to Neat little ko.observableArray trick over 1 year ago

You don't necessarily need to use unwrapObservable. It's used for places when you accept input that might be observable or not. In this case we know it's an observable(because later we are updating it's value, if it wasn't an observable, it would have thrown).

So you can do this:

var array = ko.observableArray([]);
var tempArray = array();
for (var i=0; i<100; i++) {


There's tons of optimizations in JQuery and sizzle and then since they use DOM too, there's another set of optimizations are done. What I'm saying is that no matter how much you know about JQuery, Sizzle(, or even a certain browser internals and how it deals) it wouldn't be easy to just predict what operations will faster. There's too many optimizations that may or may not happen. I suggest you all read this two:

If you want what is faster, write a real world test case for both cases. At times it may not be even noticeable. And again don't just try to predict stuff like this. If were you I would go with $('#foo a'); because it's easier to read. Later IF I FEEL MY APP IS SLOW , I'll profile it. If $('#foo a'); was the bottleneck, I just replace it with something efficient, but this I make sure I'll measure it correctly.

109 Karma
3,282 Total ProTip Views