jsninja's profile picture. Here on Twitter I will sporadically divulge sensitive information regarding JavaScript and its various abstractions...

The JavaScript Ninja

@jsninja

Here on Twitter I will sporadically divulge sensitive information regarding JavaScript and its various abstractions...

The JavaScript Ninja รีโพสต์แล้ว

Did you watch @paul_irish live-fix some performance issues on a site with janky scrolling yet? youtube.com/watch?v=HAqjyC…


JS Promises are the ones you don't make to yourself.


Learn JavaScript by programming a warrior jswarrior.fusioncharts.com


Know thy self, know thy enemy (@uglyjs). A thousand battles, a thousand victories.


for (var i = -1, l = array.length; ++i < l;) // Yet another array looping 'pattern' (not original)


poll - "What identifier do you tend to use to reference out-of-scope contexts in your JavaScript code?" - twtpoll.com/tfvfko


Random value from array: ['which', 'word', 'i', 'wonder', '...?'][0|Math.random()*5]


~~n and n|n are the clear winners in the flooring benchmarks: http://ernestdelgado.com/archive/benchmark-on-the-floor/ (via @paul_irish)


Technically, you could use labelled compound statements ("blocks") to annotate pieces of code: http://bit.ly/an5l1U


http://www.spritely.net/ - Useful for CSS sprite animation


Answering Baranovskiy’s JavaScript quiz - http://www.nczonline.net/blog/2010/01/26/answering-baranovskiys-javascript-quiz/


Understanding Delete - http://perfectionkills.com/understanding-delete/


Instead of (new Date()).getTime() ... You can just do +new Date


Optimise your Waterfall! http://www.phpied.com/free-falling-waterfalls/


Degradation of skills as a result of JS libraries - http://bit.ly/7Kpnmy


Want a free copy of the new jQuery cookbook (O'Reilly)? http://james.padolsey.com/javascript/the-jquery-cookbook/


Quick indexOf failure trick: !~string.indexOf(something) .... No need for ==-1


And, obviously, the other comparison operators work in a similar fashion. "a" <= "b" && "c" > "a"


"alpha" < "bravo" ... You can use the less-than operator on strings! (helps with lexicographical ordering)


Loading...

Something went wrong.


Something went wrong.