Posts Tagged ‘server side javascript’

Javascript best practices

18 Jan

Well I guess if I’m going to write any code then I should write it well. In an attempt to address my aversion to using javascript to do anything more complex than mucking about with the DOM and spicing up the interaction layer I’ve been looking around at how other folks are doing it.

Many of the blogs, discussions and  articles I found had a lot to say about old school client side javascript but that’s not what I’m looking for. I did come across this article on It discusses javascript best practices in a server side context and address one of my javascript bug bears. Specifically “what is this“, meaning what is the this that is currently in scope and how can I write my code so that this will be what it to be? By using the bind method when returning functions or passing functions as parameters the context in which they are called (their this) can be determined.

My mistrust of javascript as the sort of language you would want to do complex things with has decreased a little. In my next post I hope to describe the tools and environment needed to solve my pet problem described in  this article.

Stuart McFarlane

Mobile Media Constructs