JavaScript - Yahoo News Search Results

119.88 ¥/$ (5 p.m.)

Sorry, but your browser needs Javascript to use this site. Pro-Russian fighters patrol Tuesday in in the village of Shirokine near the strategic port of Mariupol, Ukraine.

Popular JavaScript Package Manager Npm Raises $8M, Launches Private Modules

 Most JavaScript developers are familiar with the npm package manager, which was originally developed by Isaac Schlueter. What many probably don’t know is that npm is also a company co-founded by Schlueter to support the project. Today, npm announced that it has raised $8 million on top of the $2.6 million seed round led by True Ventures the company announced last February. The lead… Read More

120.13 ¥/$ (9 a.m.)

Sorry, but your browser needs Javascript to use this site. Four out of 7 patients, including foreign visitors, who had liver transplants died within one month after the surgery at a new hospital in Kobe established in November, the Yomiuri Shimbun said Tuesday.

SCENE AROUND Special Populations Prom, April 11

Javascript is Disabled! This slideshow viewer requires javascript. To view this slideshow either enable javascript and refresh the page or go to

Cool tools for compiling to JavaScript

Every programmer has a favorite language or two. JavaScript lovers are the luckiest these days because their language is taking over the Internet and the Internet is taking over the world. Those whose hearts reside elsewhere in the programming language world, however, are stuck. They can either stay on the sidelines and curse the relentless juggernaut of HTML, CSS, JavaScript, and Node.js, or ...

Google refocuses Dart as a JavaScript helper

Backing down on ambitions to create a commercial grade Web programming language, Google is shifting work on its Dart programming language to make it an optimization aid for the pervasively popular JavaScript, which Dart was originally designed to supplant. The company no longer plans to incorporate Dart into its Chrome browser, the two creators behind Dart announced in a blog item posted ...

Instant feedback arrives for JavaScript code testing

Developers looking for quick results when testing JavaScript code could have a solution with the Wallaby.js test runner tool, a code coverage technology intended to offer nearly immediate reporting of results.


recent bookmarks tagged JavaScript

Javascript Replace All Hashtags w/ Links

Posted on 3 April 2015

Programmer: ASP.NET AJAX: Calling PageMethods Synchronously

Posted on 3 April 2015

Creating a downloadable text-file using blobs - JSFiddle

Posted on 3 April 2015

Posted on 3 April 2015

Draft Countdown

Posted on 3 April 2015


Posted on 3 April 2015

Posted on 2 April 2015

Posted on 2 April 2015

Posted on 2 April 2015

Posted on 2 April 2015

Top Answers About JavaScript (programming language) on Quora

Top Answers About JavaScript (programming language)

Why do a few of my co-workers argue that JavaScript isn't real programming?

Most-likely because they don't know what they're talking about. Or because they've made up some quirky, personal definition of "real programming."

Here's how I define "real programming:" writing code in a Turing complete language. People write code in Javascript, and Javascript is Turing complete, so by that definition, Javascript programmers are doing real programming, and Javascript is a real programming language.

I suppose you could define "real programming" as writing code of some arbitrary level of complexity. By that measure, Javascript also passes muster. Of course, there are people writing very simple applications, but there are also people writing very complex ones, such as gmail and google maps. It's not strange nowadays for client-side code to be massively more complex than whatever is happening on the server.

See question on Quora

Posted on 22 March 2015

Why do a few of my co-workers argue that JavaScript isn't real programming?

I was about to tell you that if they use the Spotify Mac, Windows and Linux app, you could tell them that it's primarily written in JavaScript, but to be frank, if you are in an organization that tolerates this brand of incompetence and bigotry, you don't have anything to gain by arguing with it.

I was lectured at a former consultancy gig that "you don't use version control in real projects" by a team lead. In a situation where things are that bad, the situation cannot be helped. Just bide your time and start making plans on how to move to greener (hint hint) pastures.

If you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 21 March 2015

Why do a few of my co-workers argue that JavaScript isn't real programming?

I'll argue with anybody about customer requirements, the best way to accomplish a particular goal, and the schedule.  However, I decided a long time ago that it's never worth the effort to get involved in arguments over who's really a programmer or which language/editor/OS is "the best."  George Bernard Shaw once wrote, "I learned long ago, never to wrestle with a pig.  You get dirty, and besides, the pig likes it it," and I can't help thinking he would have been a great programmer with that kind of attitude.

If they're not interested in learning, but (obviously) still need you to do the work, there's nothing you're going to say beyond asking them how you're getting your results.

See question on Quora

Posted on 20 March 2015

Why do a few of my co-workers argue that JavaScript isn't real programming?

I have a simple approach for dealing with this particular class of co-worker.

If they won't believe you when you say JavaScript is programming and that what you are doing is simple markup, agree with them.  Then offer to get them a workstation and inform them that if they understand this better than you, they must be able to do your job better than you, hand them the tools and say "Here you go!  Prove me wrong by being better than me!".

Then watch how fast they backpedal from their statements.  More often than not this is a situation of someone having a little knowledge or picked up something via osmosis and think they know a lot.  Very common among non-technical people who interact with technical staff or deal with procuring solutions.

But do not ignore them.  Challenge them and work to educate them.   As my "get them a workstation and do my job better than me" example illustrates.  Harsh but effective.  I've only had to do it a few times but it gets people who think they understand technology and implementation of it to think about what they are saying and make them "put up or shut up".

A less cruel way is to actually sit down with them and walk through the logic they believe to be missing.  Show them how the code works.  Ask them to even work with you to write it.  Either way, they'll get the message.

If you ignore them eventually they are going to make a promise to someone else, usually higher-up, that is impossible to meet but leave you holding the bag.  By not challenging their assumptions you are silently saying they are correct.  This can be a fatal, career-ending mistake. 

If you can't bring them around and show how yes, you are a programmer doing programming things, update your resume and start looking.  Such a toxic environment will eventually cause you to bear blame and outcomes that you didn't create out of their own naivete and uncorrected ignorance.

See question on Quora

Posted on 20 March 2015

I am Java developer who wants to learn JavaScript. Which technology, Angular, jQuery, or Node.js is better to learn nowadays?

Welcome to the front, Java developer! Good to have you.

In comparison to other languages, the JavaScript community changes methodologies, frameworks, build systems and even their virtual machines like most people change their socks. It is therefore much more important to have a fundamental understanding of the language itself, rather than learning a specific framework idiom. If you invest heavily in a certain technology, you'll be in for a world of hurt.

Luckily, JavaScript is also a very small language compared to other languages, so you'll be able to assimilate it quickly. I always recommend people to start with JavaScript: The Good Parts. It's a few years old, but since JavaScript is an open standard the language itself changes very slowly.

All that said, the things that are hot right now in the JavaScript community are (and this list is biased as hell):
  • React and Flux is the hot new thing (especially the just-released React Native. Developed and used by Facebook. It is really good.
  • Angular (the old but popular, big thing, developed by Google). Currently between two very different major versions so I'd stay away for a few months until the dust settles.
  • Backbone is a good-old MVC framework for use in the client side of things.
  • node.js and io.js. They are the same thing, where io.js is a recent fork. Think the hudson/jenkins split. Use node.js for now, but there is a good chance that io.js will win out, so be aware.
  • npm is the major package manager for JavaScript. It's has a module for goddamn everything. There is also jspm and bower. jspm is nice but too new, but Bower is stupid and should be avoided.
  • Browserify is the best thing since sliced bread - it allows you to use npm modules in the browser, not just the server.
  • Gulp and Grunt are build systems. Gulp is the newer one, but pretty mature. It's the one you should use.
  • express.js is what you want if you want to build stuff server-side.
  • Meteor is a super futuristic and cool full-stack framework that is awesome but does pretty much everything in a different way than everyone else. It's very popular, and you should definitely try it to get your mind blown.
  • jQuery is to JavaScript what Wordpress is to PHP. Everyone learns it and then tries to do everything with it. You should not do this. jQuery is a good tool for DOM manipulation, use it for that and nothing else.
  • Learn some functional programming. This is the best way for me to ensure that you can never go back to Java. See my answer to What is a simple explanation of higher order functions and callbacks in JavaScript?

I know, this all feels overwhelming. That feeling doesn't really go away, just embrace it. Breathe deep. Wooooo!

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 12 February 2015

Is Angular 2.0 diverging from 1.x really that bad?

Yes, but not for the reason that you think.

For your average JavaScript framework, it's really not that big of a change. JavaScript frameworks change around like crazy all the time. One day, you're using Grunt as your build system, the next day, you're using Gulp. This is the front, soldier!

That said, not all developers (and their tech departments) want to be in the front. They really don't like breaking changes.

There are no prescribed best-practices for building JavaScript apps. A small team of senior developers can invent this for themselves, but if your team is large and with only few senior developers in it, you start looking for a platform that offers your team an existing structure for how to go about things.

You start looking for a stable, well-documented platform that it's easy to hire developers for because it is popular and well-known. It's also a bonus if it isn't too different from what is already being done (often Java or .NET) so that existing developers can be re-trained without much fuzz. This is what Angular offers, and it is one of the main reasons it got popular.

For a framework with this market position, breaking backwards compatibility in a major way is not going to be popular. People start realizing that Angular isn't the smooth sailing they expected it to be.

Angular is also getting a lot of traction from the fact that Google is backing it. Java companies are looking for the JavaScript-equivalent of Sun, and .NET companies are looking for their new Microsoft. They thought they had found it in Google, but the changes made in Angular makes people start suspecting things:

  • Is Google really relying on Angular?
  • Is it really critical for them to support it?
  • Isn't it really strange that Google Inbox isn't built in Angular?
  • Isn't it worrying that almost no Google products are built with Angular?
  • Would Google have broken backwards compatibility in this way if they dogfooded Angular?

Now, I'm not saying that Angular is doomed or anything - it's a very, very popular framework. That said, if I was running that project, I would place a lot of effort in ensuring a good experience for the people stuck on the 1.x branch, because that is much more important for Angulars community than other frameworks.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 7 February 2015

What is a simple explanation of higher order functions and callbacks in JavaScript?

var animals = [
  { name: 'Waffles'type: 'dog', age: 12 },
  { name: 'Fluffy',   type: 'cat', age: 14 },
  { name: 'Spelunky', type: 'dog', age: 4 },
  { name: 'Hank',     type: 'dog', age: 11 },
var oldDogs = animals.filter(function(animal) {
  return animal.age > 10 && animal.type === 'dog';
// oldDogs will now be an array that contain only Waffles and Hank objects.

filter in the above example is a so-called higher-order function. This is a fancy word for a function that accepts another function as an argument. In the above example, the function (sometimes referred to as the callback) passed to filter will be called once with each item in the animals array as the argument. If the callback returns true, the items makes the cut for the new array that filter is creating, which is what ends up in the oldDogs variable.

I think that JavaScript should get more credit for popularizing higher-order functions - JavaScript was the first mainstream language to include them, and they are incredibly useful.

map is another example of a ridiculously useful higher-order function. Once you learn to use map, your life as a programmer changes. You'll start understanding what all those crazy functional programming buffs think is so great. Here is the same example as above, but with map added:

var animals = [
  { name: 'Waffles'type: 'dog', age: 12 },
  { name: 'Fluffy',   type: 'cat', age: 14 },
  { name: 'Spelunky', type: 'dog', age: 4 },
  { name: 'Hank',     type: 'dog', age: 11 },
var oldDogNames = animals
  .filter(function(animal) {
    return animal.age > 10 && animal.type === 'dog';
  .map(function(animal) {
// oldDogNames will now be the array [ 'Waffles', 'Hank' ].

Again, map is a higher-order function just like filter is. Map accepts a callback function, that is called for every item in the array that filter returns in the above example. Map will take every return value from the callback and create a new array with them - in this case, just the names.

Higher order functions really shine with the arrow function syntax that was added in EcmaScript 6. Look how gorgeous it becomes once you use them, and use a shorter variable instead of animal:

var oldDogNames = animals
  .filter((x) => x.age > 10 && x.type === 'dog')
  .map((x) =>;

Another common functional programming concept that is also implemented on JavaScript arrays is reduce:

var totalDogYears = animals
  .filter((x) =>  x.type === 'dog')
  .map((x) => x.age)
  .reduce((prev, cur) => prev + cur, 0)
// totalDogYears will be the integer 27 (Waffles 12 + 
// Spelunky 4 + Hank 11)

(Again, the above example uses the upcoming arrow function syntax)

Reduce sounds scary, but it's actually a ridiculously simple function - it just iterates over all values in the array, passing in the value returned from the prior run as the first value (prev in the above example) and the currently iterated value as the second, making ithandy for summing things up like we do a above - the name of the function comes from reducing a list to a single value. For the first iteration, there is no previous value of course, so prev will be the second argument passed to reduce, 0 in the above case.

I hope that I've piqued your interest a bit, there are tons more functions patterns like map and filter in functional programming, so you're in for quite a treat once you start going down this path. Making your programming style more functional will improve you a lot as a programmer.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 6 February 2015

What is the best way to handle floating point problems with financial calculations in JavaScript?

Never use floating-point numbers for financial calculations. As you have observed, this leads to rounding problems because most decimal fractions like [math]0.1_{10} = 0.00011001100110011\dots_2[/math] have no exact finite representation in binary.

Instead, just represent all monetary values using an integer number of the smallest relevant units of the currency, e.g., cents. You don’t need a special library for this. Plain JavaScript numbers are guaranteed to be able to accurately represent every integer between [math]-2^{53}[/math] and [math]2^{53}[/math], and [math]2^{53}[/math] cents is about nine quintillion dollars.

(Don’t divide by 100 again and convert to dollars, like the example you gave. Just leave everything in cents.)

See question on Quora

Posted on 28 January 2015

I recently noticed that some companies/developers, migrated or adopted Go language over Node.js. Why is that?

Your app grows up.

A junior developer looks for the ultimate language. An experienced developer knows that a product has different tooling needs when it is in beta compared to a product that has been in production for a year or two.

As humans change partners, living arrangemnets , hobbies, habits and food as we grow older, apps will have different needs.

Go is a pseudo-system language specifically made for concurrency. While Node.js is a great way to very cheaply get a decently performing message-based service running, it is less ideal once your application starts getting more mature. The flexibility of Node.js is not as important to you any more, since you nowadays know what your app is, unlike in the early days when you weren't even sure if your app was a good idea in the first place. Now, your app is successful, and changes less, and you are more willing to sacrifice that flexibility for ease of maintenance and stability.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 19 January 2015

Why are IT systems in big enterprises usually built using Java, instead of Python or JavaScript?

At Spotify, we use Java extensively in the backend. This is not for legacy reasons, it's an active choice. We use Python too, but we have moved more and more to Java. The reason is that Java is much easier to get to perform well. Python is easy to write initially, but getting it to perform well when being hammered by 15 million paying users is another.

I personally don't understand how a medically sane person can like the Java syntax. However, no intelligent person can deny that the JVM is pretty darn good. It is fast, well-tested, well-documented and under active development. This cannot be said about many tools in software development.  

We used to have quite a bunch of C++ services, but while you can get C++ very fast too, it's harder to write, especially if you want the code to be maintainable. Java is a compromise that hits a sweet-spot for us.

Clojure is gaining tractions at Spotify, many new services are written in it, but it's not as wide-spread yet. While Clojure is certainly a better language, Java has the advantage of being non-weird. Java is an uncontroversial programming language that all experienced programmers can jump into with little effort, and that is a big advantage.

If you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 17 January 2015

How many boring steps in programming were there for you, before it became exciting?

I got stuck playing Grand Theft Auto: San Andreas on my PC! I had to figure out a way to get rid of the update to unlock my old saves. I ended up messing with one piece of the source code that was open to modify, it was written in C (If I only had known what C is).

I went to buy this book (This exact copy) for $75. In North Iraq $75 is a lot of money:

My cousin, Misho, who was an actual Engineer at the time told me few things:

  1. First, that is C++, you wanted C, those are not that close. AND no the ++ doesn't mean a better version. (My logic back then :/ )
  2. Second, this is for someone who can understand at least College level English, wait do you even know what a TextBook is Yad?
  3. Third, why did you break the game again? It doesn't look like that you are going to be playing it anytime soon.

Hence, the journey started my friend! I went on an epic mission to fix the game back! Didn't know what was coming, it got dark really fast.

I ended up making a MOD on the game and never being able to fix it. I downloaded the free available 3D car models and added them to the game.
My first 101 programming project as a 16 years old (It was one of the most exciting things I have ever done in my life).

When I showed the game Mod to my friends, the reaction was something like this:

For those who are interested here is what the game ended up like:
Hitman: Blood Money MOD in GTA :):

I found a Forum that gave all the Car Models for free and I gave them my Mod for free. Back then startup tactics was such simple!

See question on Quora

Posted on 14 January 2015

How can I run a Node.js web app on a shared hosting?

I don't know about other people, but for me, shared hosting is a horrible, old technology that I've left behind many years ago. I would not wish it upon my enemies. Whenever I run node in small deployments I always use a PaaS like Heroku, Nodejitsu or Modulus.

There is a wide-spread misconception that shared hosting is simpler and cheaper for small sites than PaaS solutions. In fact, PaaS is extremely easy to set up (if it requires setup at all), and is generally *free* for small apps.

Given that you have a normal node app, the steps to deploy it on Heroku (for free) is a follows:

1. Sign up for Heroku account
2. Install Heroku Toolbelt
3. Run "heroku login" in terminal
4. cd to your app
5. Add a scripts/start line to your package.json to tell Heroku what to run, and commit the change to git.
6. Run "heroku create myappname"
7. Run "git push heroku master"

Your app is now running on

Adding a custom domain, mongo database, or any of the many convenient plugins that they offer is one click away in a pretty web interface that they offer.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 7 January 2015

What are the pros and cons of the various JavaScript package managers?

Homebrew (or colloquially just Brew) and apt-get are popular package managers for Mac OS and Linux, respectively. They are used for installing developer tooling on your machine. They have existed for a very long time, and are not specific to JavaScript, and are not used for installing JavaScript packages, but is instead used to install bigger tooling, for example node.js itself, or mongodb.

npm is often misunderstood as a package manager for just node.js components. It was originally a package manager built for node, but has evolved into a pretty great general-purpose package manager, when used with Browserify (a fantastic tool that allows you to use npm modules in the browser). It handles client-side JavaScript, and static assets like CSS and HTML perfectly well. At Spotify, we use npm for distributing our shared CSS and HTML  templates and it works very well.

Bower and Jam are package managers that brand themselves as package managers specifically tailored to the client. Bower is by far the more popular of them, to a large degree because Bower is created by Twitter, and Twitter uses Bootstrap to push Bower.

I'm personally not a fan of Bower or Jam. While the idea of a package manager with tooling for client-side development sounds awesome to me, neither of Bower or Jam actually provides any useful tooling that makes the client-side experience significantly better than npm. For instance, I think it would be awesome to be able to search the registry by browser compatibility, but neither Jam or Bower offers that, and that is reflective of the entire experience - the only client-side thing about them is that they say that they are focused on the client-side. All this while throwing away the powerful tooling and ecosystem that npm provides - I don't think it makes sense.

On multiple versions co-existing (a side rant)
npm allows multiple versions of a module to co-exist in your app. If you depend on Orange 2.0, and you require package Banana, which depends on  the older, non-compatible Orange 1.0, it will still work! Automatically! Banana will use Orange 1.0 and your main app will use Orange 2.0, simultaneously.

Bower doesn't offer this ability, and only allows one version of a library. This is often described as a feature of Bower (multiple versions of a single library wastes precious bandwidth in the client) but most developers that's been around for a while knows that this philosophy sooner or later run you into what is referred to as dependency hell. For instance, let's say that your main app is dependent on a critical fix in Orange 2.0, but Banana (which is a third party component that you have no control over) has not yet been updated to use Orange 2.0. It's not realistic to wait for the Banana component to be fixed, and it's not realistic to remove the Banana dependency either because it's a significant part of your app. In this situation, gaining a few extra k of load time is looking like a low price to pay to get out of this pickle (after all, the header image of your site is still bigger than the entire app) but in Bower, you won't have that option.

It should also be noted that while npm allows you to have multiple versions of modules when you need it, but it also lets you use single versions when you don't. npm includes a powerful tool called dedupe that traverses your dependency graph and figures out where size can be made by replacing re-using compatible versions and warns you where it can't.

Lazy loading is bad (another side-rant)
Jam stresses lazy-loading modules as needed, unlike npm and Browserify that will package all your dependencies into one big chunk. While lazy-loading sounded like a pretty good idea when I started out with these tools, I can now, many years after, say to you that lazy-loading dependencies is pretty much objectively horrible from a performance standpoint. It very quickly grows into vast amounts of requests made in a hard-to-predict manner and the latency, especially on 3G (which has very long latencies), will very quickly eat up the hypothetical performance gains. Pre-compiling your app into one file will yield better performance. Lazy-loading dependencies is not a good idea.

In summary
Personally, I simply use npm and Browserify. I set my web server up to serve the node_modules directory so that I can serve CSS files and images from modules. In the off chance that I find a useful package that isn't on npm (this is very rare), I tend to include that manually in the project instead of pulling in Bower in addition to npm, as it would be to over-complicate things to have an extra package manager just for one or two packages.  

See question on Quora

Posted on 31 December 2014

What types of jobs are available for those that know just HTML/CSS and JavaScript?

By being hired by companies that require front-end development. I don't only know Javascript, CSS and HTML, but they're pretty much the only technologies I ever use at work, because there's so much front-end coding to do and so few other people on the team who know how to do it well. There are exceptions, but most of the server-side developers I know aren't Javascript experts (and vice versa).

This is because the world of computing changes so quickly, there's only so much stuff one person can keep up with. To be a relevant JS programmer, I have to study every single day. There are always new libraries, new frameworks, new techniques, etc. And my employers and co-workers expect me to know them. There aren't enough hours in the day for me to keep abreast of the front-end stuff and new developments in the PHP, Java, and Python worlds, too.

I've been a front-end developer for about ten years, and I've always been able to make a living at it. I imagine that, in the automotive world, there are people who specialize in building dashboards instead of engines.

See question on Quora

Posted on 10 December 2014

How do I outlast the software engineer gold rush/massive influx?

I have lived through the .com crash, the 9/11 downturn, and the housing market crash and I have never been out of work for more than 10 days because of these reasons:

  • Make sure that you keep learning. 
  • Make sure that you you have a few skills in your tool-belt that are tried, true, and used by the enterprise (Like C#, C++, and Java). 
  • Make sure that you actually understand the fundamentals of software engineering and not just some front end frameworks. 
  • Make sure you are competent in the full stack (database, middle tier, UI).
  • Learn about business
  • Practice communicating

To elaborate:

The tried and true languages I mentioned have far and away the most jobs and enterprise companies like banks, insurance, medical... even when the start up market has a downswing these companies will still be chugging along doing business as usual.  These sectors are very stable even if they aren't featured on hackernews. 

You need to understand fundamentals so you can acquire new skills quicker.  I love angularjs for example, but if that's the only framework you know for building front end interactive sites... you are in big trouble if it goes away.  If all you know is auto generating code with rails... again, you are in big trouble if that skill becomes less in demand (or if your company moves to something else).

As a bootcamp owner, we take people through the whole stack so they get more than just front end tech.  They know how to design database tables, use indexes, stored procedures, and basically play a junior dba role.  They understand multiple data access tools.  They know how to write and test business logic and hook it up to a UI.  I don't care if web pages disappear tomorrow... professionals will still be writing business logic, structuring data, and serving it up to whatever replaces the web on the front.

Knowing about how businesses work just flat out makes you a more effective developer.  Too many developers tend to latch on to exciting new frameworks and toys and then go looking for a problem to solve.  I want to be known as the guy on the tech team who understands the business and makes technology decisions that drive business value.

If the market changes and there is a lot of competition for jobs, the best communicators will typically beat out moderately better technicians.

See question on Quora

Posted on 2 December 2014

Being easier to understand and write, why hasn't CoffeeScript gained popularity over JavaScript?

I really like CoffeeScript and almost always use it whenever I can, but it it's not going to replace JavaScript. What is more likely is that JavaScript will pick up features from it over time.

1. CoffeeScript is really just very nice syntactic sugar on top of JavaScript. You have to know JavaScript to use it, and you have to know it pretty well too. Starting out as a programmer with just CoffeeScript seems like a big mindfuck for me.

2. CoffeeScript is easy to write and looks super sleek, but pretty hard to read unless you're experienced with it. The comprehensions and the fact that you can omit parenthesizes encourages writing code that is minimal, yet incredibly hard to skim for a human. One thing that I've learned from CoffeeScript that while parenthesizes are ugly, they do a lot for readability.

3. JavaScript is an OLD language. It's been around. To topple any product in any category with that kind of dominance, you need something that is not 20%, you need something that is at least 200% better. CoffeeScript is not.

4. CoffeeScript does not have any standalone interpreters - it depends on JavaScript interpreters, so there is not even the foundation in place so that it could replace JavaScript.

See question on Quora

Posted on 13 October 2014

How can I convince my boss that JavaScript is a very powerful language for building websites and that it is not insecure?

As a follow up to Jordan Ambra's general case answer, I'd like to add at anecdote from ten years ago.

I once had an aspiring web developer try to convince me during a code review that she didn't have to check input received during an HTTP PUT, because she had already checked it using client-side JavaScript.  We went back and forth on this for close to an hour.  When I showed her that I could form an arbitrary PUT without using her code, her response was "who would do that?". Uhh, there two billion Internet users on the planet.  It's a safe bet that a fraction of one percent of them are smart jerks, and someone out there will try to send us malformed input some time during the life of this website - and, besides it's standard practice.

If I had stopped learning at that point, I would have dismissed your suggestion on the basis that JavaScript can let novice developers think they have the bases covered when they haven't actually understood the full situation.

Things seem a bit different today with REST and powerful client-side libraries.  But the core issue remains: the need to practice secure coding at every level of the system, regardless of the tool used.

If I were listening in to the conversation you're having with your boss, I would be listening for something like the following sentiment: "JavaScript does not obviate the need for security at any level ef the system, so we still have to enforce those software-policies that we spent so much time thinking through and testing.  However, using JavaScript within that context would allow us to do $FOO and $BAR."

Of course, there may me no convincing your boss, and no willingness to re-examine old assumptions - in which case you should start considering whether you want to shop for another job.  JavaScript is a mainstay of user interface code these days, and is making its way onto the server (via node.js and others), so it's worth having it available when appropriate for both you and your organization.

See question on Quora

Posted on 14 September 2014

What technologies should one learn to stay ahead in the IT industry for the next five years?

First of all, five years is a long time in Computer Science. What's hot today, it might well not be in 6 months anymore. New technologies appear and disappear in short periods of time, so it's hard to pinpoint something specific.

However, we know that several things are not going anywhere, but will become stronger with the time.

The web is here to stay, so learn web-related technologies. Learn how to make web pages. Learn how to make these pages fast. Learn how to create a great experience for your users.

Cloud computing is getting stronger by the minute, and everything is moving to the cloud. You know this is a tendency that will get stronger and not weaker, so learn how to develop for the cloud. The language doesn't matter, but the whole paradigm does.

Learn about non-relational databases. Internet is massive today, but it will be even bigger in 5 years, so any application will potentially have billion of users. You need to learn how to make scalable applications, starting from the data layer.

There's also another bunch of software engineering topics that are useful today, and will be useful for the next 50 years: algorithms, data structures, refactoring techniques, design patterns, testing, etc. These are not going anywhere, and they have nothing to do with a specific technology or programming language.

More importantly, learn how to learn faster and better.

See question on Quora

Posted on 13 August 2014

Which JavaScript language feature is the most annoying to people?

I have a lot of the same gripes that show up on various websites.

  1. Javascript allows trailing commas which gets confusing in some cases
    // ==> ",,"
  2. Null is converted to zero in special cases
    isFinite(42); // true
    isFinite(1/0); // false
    isFinite(0/0); // NaN is not finite -> false
    isFinite('42'); // true
    isFinite('hi'); // false
    isFinite(null); // true
  3. Null is falsy, in special cases
    !null // true
    null == false // false

  4. It treats arrays in a very confusing manner

    [1, 2, 3] === [1, 2, 3]   // false
    [1, 2, 3] <   [1, 2, 3]   // false
    [1, 2, 3] >   [1, 2, 3]   // false

    But wait, there's more!

    [1, 2, 3] <= [1, 2, 3]   // true
    [1, 2, 3] >= [1, 2, 3]   // true

    Son of a bitch.
  5. Typecasting anything to a number by preceding it with a "+" symbol. So

    +"" // 0
    3 + "2" // 32
    3 + +"2" //5
  6. As Mike Grabowski mentioned, I forgot some more shit with null. Here's some confusing ones

    null == undefined //true
    !null == !undefined //true
    +null == +undefined //false
    !+null == !+undefined // true... wtf
    +!null == +!undefined // true

See question on Quora

Posted on 8 August 2014

Do developers memorize all tags, classes and functions?

I started to learn programming 8 years ago. I am now a software developer in C++ and I do at a professional level for 3 years.

Few days ago I just Google'd "printf format specifiers" (can't use streams, don't ask, long story) to see how the hell I can put some numbers in a string. Even though I did it countless times during my life. Is like one of the first things you learn in C.
I also forget the name of classes or services I use almost daily. Or my source control password. I forget what kind of algorithms STL provides or commonly used commands.

Really, I am just plain bad when it comes to memorizing. But I don't consider myself a bad developer because of this. Part of my bad memory is also because I don't actually try to memorize those. I prefer to memorize things that actually improve the quality of my work.

Sure, you'll get used and learn some of the syntax you use, but even if you forget or can't remember some, just find it. Look in the documentation or whatever. So if I were you I would not worry a single second about memorizing stuff. Worry about understanding.

See question on Quora

Posted on 5 June 2014

Do most Haskell users think JavaScript sucks?

Yeah, pretty much.

Then again, it's hardly a unique position. Most people think JavaScript sucks. Some think it's a valid "worse is better" compromise, some don't, but hardly anyone holds JavaScript up as a paragon of language design.

The most famous book about it is JavaScript: The Good Parts. That characterizes it quite well, doesn't it?

Maybe they should just have left the bad parts out, eh?

Moreover, JavaScript is pretty much the antithesis of Haskell. It's dynamically typed, and even manages to get that wrong with its absolutely terrible system of coercions. This "weak typing" is, in my opinion, one of the single worst features in any programming language.

It's also staunchly imperative. Sure, it supports first-class functions, but good luck actually using functional programming! Pretty much everything is mutable, and idiomatic code uses mutation all over the place. Even if you use your own standard library functions, the DOM is still inescapably imperative—and quite easy to mess up.

Compared to Haskell, JavaScript is not very expressive. It's flexible in all the wrong ways: you can write code that does all sorts of nonsense behind the scenes, but you don't have much control over syntax. You can't write pretty code.

It's simply not a good language.

But! The platform it's attached to is worthwhile. The web makes distribution and deployment truly trivial. It also presents what I view as quite a good model for UI code with HTML and CSS, albeit rather poorly executed. Unlike JavaScript, the web as a platform at least has its heart in more or less the right place.

This is why there are so many solutions for taking decent languages to JavaScript: we want to take advantage of the web without dealing with the morass of normal web programming.

While I haven't used any of the Haskell-specific solutions, I have used
for a couple of projects and found it to be an incredible improvement. It's just much better in almost every way. After a bit of hassle setting it up, the code was easier to write, the project was easier to maintain and everything was much easier to extend. I figure the up-front costs are O(1), but the benefits of not using JavaScript scale with, well, how much you don't use it :).

So yeah, I'd say most Haskellers think JavaScript sucks. More power to 'em!

See question on Quora

Posted on 26 April 2014

Is the "you have ruined JavaScript" article a solid argument against Angular.js?

Angular is fine.

Yes, I do agree with the original article that Angular has an obvious Java heritage that is stronger than it needs and should be. Factories (Factory method pattern) is a pattern that is very common in most Java because of it's very structural nature, but in JavaScript it's rare that you need to use them, and it's actually more of a code smell if you find yourself making factories. However, this is just one aspect of Angular and it is in general much nicer than what came before and Angular is a necessary step in evolving JavaScript. 

The fine part about JavaScript is that it's incredibly elastic. You can code it in whatever way you want. It's few languages where you actually implement class.
This is also one of the most problematic aspects of JavaScript - unlike Java or .NET, there isn't an obvious idiomatic way to code JavaScript. When someone new to JavaScript asks "How do you make a class?" the answer is sort of "How do you want to make a class? And maybe you don't want to make a class at all?"

Angular is nicer than what came before and Angular is a necessary step in evolving JavaScript.

JavaScript has a seemingly inevitable reign as king of scripting languages, so a lot of people are flocking to it. The problem is, JavaScript itself offers no guidance on how to write it, so people look elsewhere when starting out. This is where Google entered, with Angular. It offers a clear and sort-of-familiar way of dealing with building JavaScript apps. It's built by Google, filled with Java kings of over-engineering, so it's going to be bound to have at least a few FactoryProviderProviders in it, but it's pretty okay.  Angular offers a decent way of structuring your applications.  At least it's a huge step up from Google Web Toolkit (GWT), their former Java monster. It's also a step up from Backbone, which held this crown before, that promised minimalism but in reality tended to result in surprisingly large code bases.

Just like we moved from random hacking to jQuery plugins to Backbone to Angular, I believe the culture around JavaScript will evolve again in a year or two, and leave our AngularFactoryProviderFactoryEnterpriseServices behind.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 26 April 2014

What can PHP do that JavaScript can't?

This is a bit like asking what you can say in German that you can't say in English. In general, there is very little that you can't do with programming language X that you strictly cannot do in programming language Y. Almost all programming languages are pretty general-purpose, and it's more about what one language is more suited to do. There are of syntactical differences about how you do things in one language but cannot do in the other (For example, PHP has variable variables while JavaScript has closures, and German has the excellent word Schadenfreude) but that's generally just different ways of approaching things.

Also, to clear some things up, because I feel there is a bit of misinformation going on in other answers:

Both JavaScript and PHP can run server-side. Web browsers have JavaScript engines built in, and this makes a lot of people assume that JavaScript is for clients and PHP is for servers. This is false. JavaScript is widely used in production server-side, using node.js. Node.js is not another language, it's just JavaScript. Simple, low-cost options are available for small deployments, and large companies like PayPal uses it in production.

Both JavaScript and PHP are object-oriented, and has extensive support for inheritance and polymorphism. PHP is more classically oriented and you will be more comfortable with it if you're coming from a background of Java, while JavaScript has a more flexible (but harder to understand) inheritance model called prototypal inheritance. JavaScript and PHP both have classes, but PHP has a more extensive support for them. (You tend not to need classes as much in JavaScript though for a number or reasons, but that's beyond the scope of this answer).

Both JavaScript and PHP both have extremely cheap hosting options available. For initial small-scale deployments, both have very cheap or free options available and when moving to VPS or bigger they both have similar performance requirements.

See question on Quora

Posted on 19 April 2014

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

Using the attribute selector is tantamount to sorcery:

Select all <a> that are hrefs:

Select all elements that have a class (useful if JS is adding classes somewhere)

Select an ID, but with the specificity of a class: 

section[id="sideBar"]{color: red}

Style all links that are fully qualified URLs, knowing that ^ means "starts with":

Need to style a link to a ZIP or a PDF? Totally fine, too. Use the $ which means "ends with"


Style an image based on one word existing in the alt attribute? Let's use the space substring selector:


Style an image based on the name of the image file itself? Also doable, even if you're image is this-image-shot-april-2-2014.png. The | is a hyphen substring selector:


There's some even more crazy stuff that you can do with the attribute selector, which I wrote about here: CSS Sorcery: Performing Magic with the Attribute Selector

See question on Quora

Posted on 24 March 2014

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

* { background-color: rgba(255,0,0,.2); }
* * { background-color: rgba(0,255,0,.2); }
* * * { background-color: rgba(0,0,255,.2); }
* * * * { background-color: rgba(255,0,255,.2); }
* * * * * { background-color: rgba(0,255,255,.2); }
* * * * * * { background-color: rgba(255,255,0,.2); }

This is one of my favourite inventions.

But what does this horrible thing do?

It is meant to be used when you are working with layout, e.g. take

The problem is that unless the element on the page has a solid background or it is a picture, you do not see how does it fit into the layout, e.g. most of the text nodes, pictures with transparency, etc.

With the above CSS, you will see something along the lines of:

Different depth of nodes will use different colour allowing you to see the size of each element on the page, their margin and their padding. Now you can easily identify inconsistencies.

See question on Quora

Posted on 19 March 2014

When does it make sense to use an MVC framework for JavaScript?

A very good question to ask when you start becoming fluent in JS and want to do a lot more.

So let's dissect it line by line and "grow up" to using an MVC framework.

Plain Old JS: You learn JS and you use this for creating the necessary form validations, adding behavior to your pages etc., You like how things are going but you find the DOM API rather clunky and tricky to remember. You WISH there was a different way of doing things. Something that would lower the bar for becoming comfortable with traversing the DOM and adding behavior in a web page.

JS + jQuery: Ta-da! You've just found a wonderful library that makes adding behavior to the HTML pages SO much easier. You start falling in love with the callback based design of jQuery. You write a callback for this and that and this and that. Your pages come to life and you are on top of the world (or that's what you feel).

Good. But when you are in the flow of adding these callback and initializing everything in
you decide to look back at your code and see it's one HUGE file with lots of functions and callbacks and logic for weaving everything together. Your DOM manipulation logic is intermingled with ajax requests/response handling code. You add dynamic HTML to your code in the same place, perhaps with or without a templating solution.

You decided to split your functions into various files to make it more manageable but then everything is spread everywhere.

Soon, your boss comes to you with an interesting feature request: We would like to tag every post on our system with color coded labels (i.e., something like tagging emails with color coded labels in Gmail).

You say, that's cool, let's get on with it. But when you sit to analyze just "how" you wish to implement this rather non-trivial feature your realize that it'd add about 1000+ lines of code with LOTS of functions/callbacks and repetition. You then head to Stackoverflow with questions like: The gmail label chooser problem - is there a better way to do it?

You realize, let's "objectify" things for better code organization. So instead of functions/callbacks you organize your code using JS objects:

var MyApp.Posts = {

 selectPost: function(){},
 addLabel: function(){}
 ...// other variables and functions


This makes life easier and you are on your way to well designed labeling system for your web app. You gain immense satisfaction. You realize this way of doing this is REALLY good. Let's make this a generic framework for others to do. You learnt that it was good to organize things as per their responsibilities, view managers to handle the DOM, even handlers to handle the user events, data handlers to help synchronize data with the server. You just had a BIG aha! moment with "how" to effectively design your application in a maintainable way. You were on your way to making a generic library when someone told you about "Backbone.js".

You read up and go OMG! Someone's put some great thought into this and makes application designing a lot easier. You are now on your second nirvana. You couldn't believe just how lived with Backbone.js and the corresponding MVC paradigm of organizing your code base. You wish to backbonify everything you ever worked on. Then you read about Angular, Ember, Knockout etc., and went over to TodoMVC to see how all of them are similar/different. Now you are confused and are then on Quora, wondering if all of it is worth it :)

You see, MVC adds structure to your application. Makes your code much more maintainable and supports code reusability. It's much easier to manage complexity. (Just like how object oriented is better than procedural, in most cases). People can see your code and make sense of it since MVC is common knowledge. They don't have to think how/why you did the way you did it. It makes sense to them. MVC has stood the test of time and has proven itself time and again to be one of the most used patterns of all time. Brilliant separation of concerns with excellent code maintainability giving you the freedom to structure some very hard to imagine application functionality. You can basically create class diagrams to analyze the structure of your JS heavy web app and can directly translate it the M-V-Cs of the underlying framework. You can now leverage the power of OOAD for JS too! I think these are reasons good enough to learn and use an MVC framework for JS :)

So "when" exactly should you use them? Well unless your page is really simple I'd say "all the time" :) (Think about when you should used object oriented vs. procedural. In most cases the answer will be 'all the time'. Think of MVC frameworks objectifying spaghetti/callback-hell JS.)

(PS: This is a true story :) Hope this motivates you to realize the worth of MVC frameworks for JS)

See question on Quora

Posted on 21 February 2014

What are 5 essential skills every Web Developer should have?

The idea here is that most of us should already know most of what is on this list. But there just might be one or two items you haven't really looked into before, don't fully understand, or maybe never even heard of.

Interface and User Experience
  • Be aware that browsers implement standards inconsistently and make sure your site works reasonably well across all major browsers. At a minimum test against a recent Gecko engine (Firefox), a WebKit engine (Safari and some mobile browsers), Chrome, your supported IE browsers (take advantage of the Application Compatibility VPC Images), and Opera. Also consider how browsers render your site in different operating systems.
  • Consider how people might use the site other than from the major browsers: cell phones, screen readers and search engines, for example. — Some accessibility info: WAI and Section508, Mobile development: MobiForge.
  • Staging: How to deploy updates without affecting your users. Have one or more test or staging environments available to implement changes to architecture, code or sweeping content and ensure that they can be deployed in a controlled way without breaking anything. Have an automated way of then deploying approved changes to the live site. This is most effectively implemented in conjunction with the use of a version control system (CVS, Subversion, etc.) and an automated build mechanism (Ant, NAnt, etc.).
  • Don't display unfriendly errors directly to the user.
  • Don't put users' email addresses in plain text as they will get spammed to death.
  • Add the attribute rel="nofollow" to user-generated links to avoid spam.
  • Build well-considered limits into your site - This also belongs under Security.
  • Learn how to do progressive enhancement.
  • Redirect after a POST if that POST was successful, to prevent a refresh from submitting again.
  • Don't forget to take accessibility into account. It's always a good idea and in certain circumstances it's alegal requirement. WAI-ARIA and WCAG 2 are good resources in this area.
  • Don't make me think


  • Implement caching if necessary, understand and use HTTP caching properly as well as HTML5 Manifest.
  • Optimize images - don't use a 20 KB image for a repeating background.
  • Learn how to gzip/deflate content (deflate is better).
  • Combine/concatenate multiple stylesheets or multiple script files to reduce number of browser connections and improve gzip ability to compress duplications between files.
  • Take a look at the Yahoo Exceptional Performance site, lots of great guidelines, including improving front-end performance and their YSlow tool (requires Firefox, Safari, Chrome or Opera). Also, Google page speed (use with browser extension) is another tool for performance profiling, and it optimizes your images too.
  • Use CSS Image Sprites for small related images like toolbars (see the "minimize HTTP requests" point)
  • Busy web sites should consider splitting components across domains. Specifically...
  • Static content (i.e. images, CSS, JavaScript, and generally content that doesn't need access to cookies) should go in a separate domain that does not use cookies, because all cookies for a domain and its subdomains are sent with every request to the domain and its subdomains. One good option here is to use a Content Delivery Network (CDN).
  • Minimize the total number of HTTP requests required for a browser to render the page.
  • Utilize Google Closure Compiler for JavaScript and other minification tools.
  • Make sure there’s a favicon.ico file in the root of the site, i.e. /favicon.ico. Browsers will automatically request it, even if the icon isn’t mentioned in the HTML at all. If you don’t have a/favicon.ico, this will result in a lot of 404s, draining your server’s bandwidth.

SEO (Search Engine Optimization)
  • Use "search engine friendly" URLs, i.e. use Page on instead Page on
  • When using # for dynamic content change the # to #! and then on the server$_REQUEST["_escaped_fragment_"] is what googlebot uses instead of #!. In other words,./#!page=1 becomes ./?_escaped_fragments_=page=1. Also, for users that may be using FF.b4 or Chromium, history.pushState({"foo":"bar"}, "About", "./?page=1"); Is a great command. So even though the address bar has changed the page does not reload. This allows you to use ? instead of #! to keep dynamic content and also tell the server when you email the link that we are after this page, and the AJAX does not need to make another extra request.
  • Don't use links that say "click here". You're wasting an SEO opportunity and it makes things harder for people with screen readers.
  • Have an XML sitemap, preferably in the default location /sitemap.xml.
  • Use <link rel="canonical" ... /> when you have multiple URLs that point to the same content, this issue can also be addressed from Google Webmaster Tools.
  • Use Google Webmaster Tools and Bing Webmaster Tools.
  • Install Google Analytics right at the start (or an open source analysis tool like Piwik).
  • Know how robots.txt and search engine spiders work.
  • Redirect requests (using 301 Moved Permanently) asking for www.Example Domain to Example Domain(or the other way round) to prevent splitting the google ranking between both sites.
  • Know that there can be badly-behaved spiders out there.
  • If you have non-text content look into Google's sitemap extensions for video etc. There is some good information about this in Tim Farley's answer.

  • Understand HTTP and things like GET, POST, sessions, cookies, and what it means to be "stateless".
  • Write your XHTML/HTML and CSS according to the W3C specifications and make sure they validate. The goal here is to avoid browser quirks modes and as a bonus make it much easier to work with non-standard browsers like screen readers and mobile devices.
  • Understand how JavaScript is processed in the browser.
  • Understand how JavaScript, style sheets, and other resources used by your page are loaded and consider their impact on perceived performance. It is now widely regarded as appropriate to move scripts to the bottom of your pages with exceptions typically being things like analytics apps or HTML5 shims.
  • Understand how the JavaScript sandbox works, especially if you intend to use iframes.
  • Be aware that JavaScript can and will be disabled, and that AJAX is therefore an extension, not a baseline. Even if most normal users leave it on now, remember that NoScript is becoming more popular, mobile devices may not work as expected, and Google won't run most of your JavaScript when indexing the site.
  • Learn the difference between 301 and 302 redirects (this is also an SEO issue).
  • Learn as much as you possibly can about your deployment platform.
  • Consider using a Reset Style Sheet or normalize.css.
  • Consider JavaScript frameworks (such as jQuery, MooTools, Prototype, Dojo or YUI 3), which will hide a lot of the browser differences when using JavaScript for DOM manipulation.
  • Taking perceived performance and JS frameworks together, consider using a service such as theGoogle Libraries API to load frameworks so that a browser can use a copy of the framework it has already cached rather than downloading a duplicate copy from your site.
  • Don't reinvent the wheel. Before doing ANYTHING search for a component or example on how to do it. There is a 99% chance that someone has done it and released an OSS version of the code.
  • On the flipside of that, don't start with 20 libraries before you've even decided what your needs are. Particularly on the client-side web where it's almost always ultimately more important to keep things lightweight, fast, and flexible.

Bug fixing
  • Understand you'll spend 20% of your time coding and 80% of it maintaining, so code accordingly.
  • Set up a good error reporting solution.
  • Have a system for people to contact you with suggestions and criticisms.
  • Document how the application works for future support staff and people performing maintenance.
  • Make frequent backups! (And make sure those backups are functional) Ed Lucas's answer has some advice. Have a restore strategy, not just a backup strategy.
  • Use a version control system to store your files, such as Subversion, Mercurial or Git.
  • Don't forget to do your Acceptance Testing. Frameworks like Selenium can help.
  • Make sure you have sufficient logging in place using frameworks such as log4j, log4net or log4r. If something goes wrong on your live site, you'll need a way of finding out what.
  • When logging make sure you capture both handled exceptions, and unhandled exceptions. Report/analyse the log output, as it'll show you where the key issues are in your site.
Lots of stuff omitted not necessarily because they're not useful answers, but because they're either too detailed, out of scope, or go a bit too far for someone looking to get an overview of the things they should know. Please feel free to edit this as well, I probably missed some stuff or made some mistakes.

Resource>> What technical details should a programmer of a web application consider before making the site public?

See question on Quora

Posted on 26 January 2014

What is the better way to program - should I write code by hand or use a framework?

My experience:

It's going to be faster and more efficient for small, young applications maintained by just a programmer or two. But if all developers in a project over and over make the call "this code will be smaller to write than adding a library" you will eventually accumulate quite a bit of code. Often a codebase that is bigger than it's framework equivalent would have been, and also very complex and hard to navigate and maintain, and maintenance is always by far the biggest cost of ANY software project older than 6 months.

We recently refactored an app written in vanilla JavaScript over the course of a 18 months, to use Knockout.js instead of vanilla JS (written by very talented developers, mind you, Spotify has a very tough interview process) and we dropped the size of the application by 2/3. You read that right, 66% of the code just went away because the vanilla JavaScript caused so many subtle duplications of effort. We've done this quite a bit during the last six months at Spotify, because we've historically had a strong "vanilla" culture going around here.

If performance is the reason that you're thinking about writing custom code,
remember that performance optimization is not a theoretical field, it's field work. For instance, jQuery is 19k gzipped or something like that. Thinking about performance on a theoretical level on individual parts of your code instead of actually profiling the app in its entirety is sort of like adjusting someones tie at party without checking if they have pants on. Once you start profiling, the performance bottlenecks you are going to find and be fixing during your first 100 hours or optimizing are going to be much more severe than a 19k lib.

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 5 October 2013

What are 5 essential skills every Web Developer should have?

  1. Be an egoless programmer. Remember that you are not your code. The only way to improve is to be open to feedback from others and give honest, non-judgemental feedback to others.
  2. Be a team player. Building software is a team sport. You don’t “own” your parts of the code. Instead, your job is to make sure the whole package works as expected. Don’t be a typical “well, it works on my machine” guy. It has to work on users machines.
  3. Be a learner. Technology is changing fast. What was hot 5 years ago is no longer the best—stuff that’s relevant today didn’t even exist 5 years ago. You have to constantly learn new things (e.g. languages, libraries, patterns).
  4. Be a T-shaped person. Specialize in one narrow field and have a general understanding of a broader range of technologies. This makes you a very valuable asset within any organisation.
  5. Be relentlessly resourceful. Become a go-to person that can solve any problem. You don’t have to be able to solve every problem yourself, but you always know where to go to find the answer.

    As in Why no one is looking for ‘rockstar programmers’ stop believing in the Ninja/Rockstar myth.

See question on Quora

Posted on 2 October 2013

What's preventing HTML based apps from taking on native apps?

First: JavaScript is NOT the problem.

I need to get this one out of the way, because there is a lot of misinformation here. This article has been circulating around the internet lately - Why mobile web apps are slow - and I think it's completely misses the point. It's titled "Why mobile web apps are slow", and then goes on an epic rant on why JavaScript is slow, and just silently and falsely assumes that JavaScript performance === web app performance.

I don't know what web apps the author of that article works in all day, but I work in the Spotify web player, which I think is a very good example of an app of over-average complexity, and I can tell you that JavaScript is very, very rarely a performance bottleneck. Yes, JavaScript is slow, but in practice, it's fast enough for what it's doing. Instead, slowdowns that I hunt down in my daily work is related to network calls and DOM manipulations, and just throwing out piles of code that shouldn't be done in the first place. I've never had a moment where I went "Oh, I wish that this piece of optimized JavaScript executed even faster".

Ok, so what is the problem, then?

Primitive framework ecosystem.
Compared to desktops, mobile devices have tiny processors, tiny batteries and tiny RAM. To get 60 FPS performance on these devices that doesn't drain the battery in a couple of hours takes a LOT of work. Therefore, Apple and Google has done a lot of that job FOR you, creating ultra-optimized components that you can re-use in your applications. They also offer quite powerful tooling to debug and profile these components.

The equivalent tooling simply doesn't exist for web apps yet. Sure, stuff like jQuery has become defacto-standard, and that has increased web app development productivity tenfold, but there is no jQuery equivalent on a higher level - the web is still a place where you build most things yourself. jQuery UI and whatnot does exist, but it simply doesn't have the same impact on interfaces that jQuery had on the DOM.

Debugging and Profiling.
The Chrome dev tools is now reaching some kind of maturity, offering quite a bit of advanced tooling support for your apps. However, this is a very nice development and hasn't spread to other browsers, and absolutely not to mobile browser debugging.

Crappy browsers, especially when embedding them.
Android just recently got Chrome - before that, it had some horrible thing that I shall leave unnamed in hopes of eveyone forgetting about it so that it doesn't become the IE6 of mobile, so to speak. Safari on iOS is sort of decent, but if you try to embed it in your app (to get notifications and in-app purchases and whatnot) you get a crappy watered-down version, and the same principle goes for Android.

See question on Quora

Posted on 17 September 2013

What are the tradeoffs of client-side rendering vs. server-side rendering?

Since Google Plus and a few other cutting-edge websites now render entirely on the client, let's review why server-side rendering is desirable at all.

Server-side rendering means when the browser fetches the page over HTTP, it immediately gets back HTML describing the page.  Server-side rendering is nice because:

  1. Your content is visible to search engines like Google.
  2. The page loads faster.  There's no "white page" while the browser downloads the rendering code and data and runs the code.
  3. It maintains the idea that pages are documents, and if you ask a server for a document by URL, you get back the text of the document rather than a program that generates that text using a complicated API.

Client-side rendering means JavaScript running in the browser produces HTML or manipulates the DOM.  The benefit is you can update the screen instantly when the user clicks, rather than waiting a few hundred milliseconds at least while the server is contacted to ask what to display.  Sites where you mostly navigate and view static content can get away with mostly server-side rendering, but I can't think of any website that doesn't do any client-side rendering.  Any portion of a page that's animated or highly interactive (a draggable slider, a sortable table, a dropdown menu) almost certainly uses client-side rendering.

People don't usually realize there doesn't have to be a tradeoff.  Why not render the initial state of the page on the server, interactive widgets and all, and then re-render the parts that need to be updated on the client?  Though it's typical to render the meat of a page on the server and then "enhance" it on the client with a library like jQuery, it's rare that a site performs the same rendering tasks on the server and client as appropriate.

The reason server-side and client-side rendering aren't typically mixed is that they are typically done in different programming environments, usually in different languages.  For example, almost all websites render the overall page layout and the content, such as blog posts, on the server, generating HTML in a language like Ruby, PHP, or Python.  On the other hand, a chat widget or an image gallery might be written entirely in client-side JavaScript, while a slider or a rich text editor certainly would be.

For websites that blend static, navigable content and app-like interactivity (or for companies that seek to provide an added measure of sanity for their engineers and designers), this divide becomes a huge pain.  This is why Google Plus does all rendering on the client.  Quora cleverly does almost all rendering on the server (including when you, say, click a "Follow" button), but only the updated parts are sent to the client.  (Particular widgets like the editor and "Promote" slider that provide instant feedback are clearly client-side.)  In an effort to increase responsiveness and flexibility, many sites now render Ruby templates on the server and Backbone templates on the client for different parts of the same user interface.  AirBnB has experimented with running client-side JavaScript templates on the server.

With server-side JavaScript on the rise, I believe the solution is simply to have a single UI framework that runs on both the client and the server, generating the initial HTML on the server and providing an interactive experience on the client.  I'm working on bringing such a framework to Meteor, which already unifies other APIs between the client and server such as fetching a URL or querying a collection of data.

In the absence of such a solution, programmers usually end up arguing either that client-side rendering isn't very important (because most sites or apps consist of large "pages" or "screens" and a round-trip to the server is acceptable when navigating between them), or that server-side rendering isn't very important (because an all-client app just needs a loading screen and a little extra attention to search engine optimization).  These arguments are motivated by the pain of having to deal with both types of rendering in the same application when they involve different languages and APIs.

Edit: More examples of major sites and their rendering strategies:  Facebook is mostly PHP but certain parts of the UI are pure JavaScript -- the chat, the comment form, probably the photo gallery.  Gmail is written in something like C++ or Java, and I'm not sure where the rendering takes place, but I'd guess it's mostly or completely on the client (given the progress bar it displays while it loads).  The old or "basic" Gmail view is presumably server-side rendered.  Github's Markdown implementation is written in C and runs on the server.  StackOverflow has two Markdown implementations, one for live preview on the client and one for the server.

See question on Quora

Posted on 7 July 2013

How would you explain objects in JavaScript to a child?

A Javascript Object is like a Mr Potato Head.

mrPotatoHead=new Object();

Every Mr. Potato Head has 'properties', or words that describe him. To assemble a Mr Potato Head out of all his properties, we can use literal notation:

var mrPotatoHead = {
     mrPotatoHead.height : "6 inches",
     mrPotatoHead.width : "3 inches",
     mrPotatoHead.isMarried : "true",
     mrPotatoHead.wife : "mrsPotatoHead"

Or we can use a constructor function:

function mrPotatoHead() {
     this.height = "6 inches";
     this.width = "3 inches";
     this.roasted = function(){
          var i;
          var slices;
          for (i=1,i<=mrPotatoHead.length;i++) {
          lunch = bake(slices,salt,pepper,oliveOil);
          return lunch;

That last part is the beginning of a nice snack, but is a little advanced for children, and the bake(); method is beyond the scope of this tutorial.

Some properties describe things he has or is wearing:

mrPotatoHead.hasOwnEyes = true;
mrPotatoHead.hasOwnPants = false;

Methods are things we can do to Mr. Potato Head. Sometimes it's a simple action:


Sometimes we need to give him more information by adding a parameter inside the parentheses:


JavaScript isn't what's called 'typed', so if we put in the wrong type of variable, it will do its best even if it doesn't make sense to mix types.


It will usually work anyway, but, yeah, it's best not to mix types.

Isn't that how everyone learned it? :-/

See question on Quora

Posted on 21 April 2013

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

You can create containers that maintain a constant aspect ratio by using padding-bottom as a percentage. The CSS spec says that padding-bottom is defined relative to the *width*, not height, so if you want a 5:1 aspect ratio container you can do something like this:

<div style="width: 100%; position: relative; padding-bottom: 20%;">
<div style="position: absolute; left: 0; top: 0; right: 0; bottom: 0;">
this content will have a constant aspect ratio that varies based on the width.

This is useful for responsive layouts where you want the width to adjust dynamically but want to keep, say, square photo thumbnails.

See question on Quora

Posted on 10 November 2012

Why is JavaScript the only client-side language available?

Before I go on answering your question, I must point out that JavaScript is a pretty darn nice language. If you don't think that, you haven't given it a fair chance. It had lambdas before C#, Java and C++ added it, has higher-order functions, and has .map and .filter built into the language! In ES6, JavaScript gets proper tail calls, making it possible to do full-fledged functional programming. If you can get over the fact that it has some (avoidable) flaws it's a very, very cool language with enormous versatility.

JavaScript has some warts, but so does all languages that has been around for a while and of the same level of popularity. C++ and Java have their fair share of ugly warts, but that always comes with popularity and age. New languages look pretty when they are young, but after years of welding on features and design compromises, they too, would have warts.

The Internet is a cobweb of different technologies cobbled together with duct tape, string and chewing gum. It's not elegantly designed in any way, because it's more of a growing organism than it is a machine constructed with intent.

We engineers always look with dread upon the existing, popular tools (not just programming languages), and see all the horrors of it. Oh, the things that now, with hindsight, could have been made so much better! But you know what, the tools are here, now. They work! And not only that, they are actually pretty darn good. Not as good as the tools of our imagined future, of course, but still very useful.

What we have today might have some glaring flaws, but you just have to work around that if you want to get stuff done during your short time on earth, or you'll be stuck in a loop creating new tools instead of using what you have to help your fellow man. Try to view your flawed, present-day tools as a relationship - your wife, girlfriend or partner will have some pretty big issues no matter how awesome they are, and that is just something that you have to work with, because that is who they are.

But I digress. Your question was why has nobody actually managed to replace JavaScript? There are two reasons.

The first reason is that people simply underestimate how hard it would be to replace. Designing a fantastic, spectacular language would only be 0.0001% of the work. Getting a language to the point where JavaScript is today is a task on the same level of difficulty as solving the Israel-Palestine conflict. Millions of hours of development time and other efforts have been spent to get JavaScript to have the advantages it has today:
  • Built in into all major browsers.
  • Multiple, well-maintained open-source engines available (JavaScriptCore, SpiderMonkey and V8) competing hard for faster and faster interpretation.
  • Incredibly well-known. Few people can code JavaScript properly, but almost everyone that has coded has written some JavaScript.
  • Not controlled by any major player (Apple sacrificed a lot gunning down Flash for this reason).
  • JavaScript has been very well kept as a standard. It is completely unique in that it's 19 years old, yet it has very few language constucts. C++ has an unfathomable amount of language constructs and takes years and years to master. JavaScript enjoys the same perks of maturity (massive documentation, lots of talent around etc) yet can be learned in a few weeks.
But the second, more important reason, is that we seem to want a single language. Java, JavaScript, VBScript and ActionScript were pretty active contenders at different points in time, but after a while, it turned out to be extremely beneficial for, us as an industry, to converge on one platform. It might have flaws, but the massive benefits of so many people working with a single (comparatively simple) language standard seem to outweigh that.

See question on Quora

Posted on 7 July 2012

What does Charlie Cheever think of Node.js?

I think Node.js is cool for mostly the same reasons that everyone else does.

The things that are really appealing about it to me are:

(1) You can use the same language on the client and the server when writing web applications.  In most cases, this probably just means that you don't have to learn two separate languages for web development.  But writing an app in JavaScript does open the really cool possibility of writing some code that can be executed on both the client and the server.  In practice, there are a lot of challenges with this (How do you avoid having to pull in all the library code from your application onto every pageload but still have enough code available for use on the client to do interesting stuff?  How do you deal gracefully with cases where the client needs data from the server to do a computation?), but there are some exciting projects addressing these questions like Meteor and Lunascript.

(2) JavaScript has a lot of momentum as a language.  There is a lot of investment going into improving its performance.  V8 is one of the best, most performant implementations around for a scripting language.  From what I've read, it's faster than almost anything comparable out there except LuaJIT and sometimes PyPy.  There's also likely to be continued investment in making it better and better over time since everyone has to use it in browsers.

Some things that I don't love about it yet:

(1) JavaScript as a language has some warts that are hard to fix because of its popularity and the many implementations that exist across many browsers.  Ex. It's awkward to iterate over an object -- you have to check
to do it properly -- and even though there are things like underscore.js that make this less bad, it's not as clean as Python.

(2) For a lot of things you tend to want to do on the server, it's much easier to think in sequential/serial/synchronous terms, rather than asynchronously, using callbacks.  Node.js started with an almost religious adherence to never blocking on anything, I/O, etc., and so that can nudge you towards awkward programming styles.  From what I've read, Node and its maintainers and community of users have been moving steadily towards a more pragmatic stance on this -- being asynchronous where it makes sense but also supporting sequential programming better, so this may be less and less of an issue going forward.

(3) Library support for a lot of things you want to do on the server isn't as good as languages like Python, Ruby, and Perl yet.  This is getting better every day and I don't think it will be much of an issue in the future, but for now, there are great tools for Ruby and Python, and I'm not aware of as-good debuggers, database interfaces, web frameworks, etc.

The strongest concrete thing I can say about it is that if I were writing an application from scratch and writing my own framework, I would probably first look at Node.js as my base (though I don't think that it provides a huge win over Python on the server + JS on the client and I'm happy with our setup at Quora).  I would be even more excited about this if mobile apps -- with their own set of languages and protocols weren't becoming as important as the traditional web stack, undermining the one-language-for-everything benefit. Overall, I think Node.js is really cool, exciting, and promising and hope to get a chance to use it beyond the playing around I've done so far!

See question on Quora

Posted on 30 April 2012

What's cool about Meteor?

I really think that Meteor is a game changer.
In the words of Ron Burgundy: If you disagree, I will fight you.

Real-time collaboration is awesome.
I think this because I think that real-time collaboration will be THE SHIT in web applications of the future. Real-time notifications and updates like the one in Google Docs, Etherpad, the instant notifications of Quora and Facebook and so on make applications much more engaging and useful. When you see the contributions of other people appear immediately on your screen in response to what you did, it creates an engagement that is just not there in apps that are not real-time.

Creating real-time collaboration apps is ass-hard.
The problem is that building stuff like this is really, really hard. Quora can do it because they have the best people and a lot of them, but a small team simply won't prioritize real-time collaboration.

Meteor makes it super-easy.
The revolutionary thing about Meteor is that it pulls all the awesome that has been happening in various projects (LunaScript, Etherpad, node.js,, Mongo, ember.js etc) into one beautiful package that makes building these kind of applications approachable to mere mortal developers like me.

Exactly 6 hours after I first heard of Meteor I had created and deployed my first application - an app to suggest and vote on where we should eat lunch at work) and had deployed to the free hosting service that meteor provides. This fucker does real-time collaboration with automatic conflict resolution more or less automatically, and it was SO easy. Do you know how INCREDIBLY hard this would be to do from scratch? I sure as hell don't, because I'm to scared to even try.

The guys behind Meteor are gods to me.
Just look at this shit: They have Geoff Schmidt, one of the guys behind LunaScript ( AND David Greenspan, creator of EtherPad ( To me, that is an extreme killer combo that can turn out nothing but awesome, and they are working on this full-time. To them, Meteor is not first-generation, they've already done this before, and learned a lot from it, and I cannot wait how this turns out.

I'm so fucking excited, man! Follow me if you're interested in Meteor, I'm sure I'll be writing tons about it..

Oh, and if you like my writing, don't miss out on more of it - 
follow me on Quora and Twitter (

See question on Quora

Posted on 13 April 2012

What are the best resources for learning JavaScript?

I highly recommend JavaScript: The Good Parts by Douglas Crockford ( It's short and explains all the best features of the language in about 150 pages.

This series of blog posts is also pretty good. It explains basics like objects, functions, closures, and references visually:

The Crockford on JavaScript video series is also an excellent introduction to the language. He explains the history of the language and shows off some of the most powerful features, including first-order functions, object literal notation (i.e. JSON), and more:

Another good way to learn the basics quickly is to build a simple web app (todo list, api mashup, etc). Building something with the YouTube API is always good fun and it's pretty easy to get started. I always find that having a project in mind makes learning new languages easier.

For any web app, I recommend jQuery ( It fixes lots of the browser incompatibilities in the DOM, and makes JavaScript a joy to work with. If you like functional programming, Underscore.js ( is worth checking out. It provides 60 odd functions that let you do lots of handy functional things.

For both jQuery and Underscore, I recommend that you dive into the source code to check out how things are implemented if you're at all curious. It's really cool to see how these libraries are operating under the hood and it's not as hard to understand the source code as you might expect.

Along that vein, Paul Irish (a developer on Chrome, jQuery, Modernizr, and HTML5 Boilerplate) has a great video entitled "10 Things I Learned from the jQuery Source" which was super interesting and contains lots of neat tidbits about JavaScript.

If you're looking for a gentler introduction more aimed at beginners, I recommend Mozilla's excellent "A Re-introduction to JavaScript" ( Mozilla also has more JS tutorials here:

Also, this won't teach you anything, but it's pretty funny: https://www.destroyallsoftware.c...

Happy hacking!

See question on Quora

Posted on 2 March 2012

What are the most interesting HTML/JS/DOM/CSS hacks that most web developers don't know about?

Some answers to my own question :)

You can quickly run HTML in the browser without creating a HTML file:
Enter this in the address bar:
data:text/html,<h1>Hello, world!</h1>

(This won't work in IE)

You can make a page's CSS editable in the browser without using JS:
<!DOCTYPE html>
<style style="display:block" contentEditable>
body { color: blue }

(This also won't work in IE)

You can have the browser parse a URL for you like this:
var a = document.createElement('a');
a.href = url;

// any property of window.location works here:
document.write('The hostname of ' + url + ' is ' + a.hostname);

(Works in all major browsers)

You can invalidate a URL in the browser's cache by sending a PUT method xmlhttprequest to it:
var xhr = window.XMLHttpRequest ?
    new XMLHttpRequest() :
    new ActiveXObject('Microsoft.XMLHTTP');'PUT', url);

(Works in all major browsers)

You can put multiple statements in an
block without using curly brackets
like this:
if (confirm("Do you wish to see two alerts?"))
  alert(1), alert(2);

(Works in all major browsers)

See question on Quora

Posted on 10 June 2011

What are disadvantages of using CoffeeScript?

CoffeeScript is a JavaScript-like language that compiles into JavaScript. Looking at the syntax, it's kind of a combination of Ruby and Python. Technically, it's very, very nice. And pretty, especially compared to JavaScript, which isn't pretty.

The problem is, CoffeeScript solves problem that really isn't a problem. The guys that invented CoffeeScript come from the same group of extreme idealists that invented the DVORAK keyboard and the Esperanto language. Yes, JavaScript isn't pretty. Yes, it does have it's flaws. Yes, it can be marginally improved upon. But the problem is that JavaScript is actually JUST FINE as a language, so the improvement is pretty small, and does NOT outweigh the drawbacks of introducing a new language.

Like DVORAK and Esperanto, the drawbacks of CoffeeScript shows when you introduce other people.

First, good luck employing a programmer that knows CoffeeScript. A search for CoffeeScript on ODesk gets you 3 contractors. Searching for JavaScript results in 23155 contractors. This means that your newly employed JavaScript programmer will have to spend time learning CoffeeScript.

While you learn the basics of CoffeeScript pretty quickly, there is still a lot of hidden time sinks compared to plain JavaScript, not only because you are not yet as comfortable with the syntax of CoffeeScript as JavaScript, because you have to translate JavaScript in documentation into CoffeeScript in your head, you'll probably have some problems debugging it as a newbie, you might be used to some JavaScript development tool, etc. etc. You new programmer will operate at 50-80% of his normal speed during his first 50-100 hours in the codebase or so, time that could be spent on actually getting things done if plain javascript was used.

Add to this two time sinks that will never go away: Context switching in your head between JavaScript and CoffeeScript and the added point of failure with another compiler.

The third issue is that there will be a lot of solid developers in your team that are not primarily JavaScript programmers, but that are perfectly capable of fixing non-complex bugs in your JavaScript code. If they see CoffeeScript, I know what they will do. They will be worried about breaking things, and go work on another bug in an area of the system they are more comfortable with.

My point is that using a language as universally known as JavaScript is a big advantage, and that big advantage is being thrown away for a marginal improvement of the language.

Follow me if you're interested in this kind of stuff!

See question on Quora

Posted on 5 June 2011

What are some good resources for Backbone.js?

Edit on December 7th 2012:

This answer is super old. I keep getting upvotes on it, so people are still finding it useful. However there are a ton more resources out there since this was first published over a year and a half ago.

Besides the official documents and wiki, I suggest that anyone coming across this answer now instead begin with Addy Osmani's very complete guide to developing Backbone apps.

Developing Backbone.js Applications

Besides that, the guides for Chaplin are also pretty good. You don't necessarily have to use the Chapin framework to appreciate the guides. Chaplin also uses a pretty standard approach to class-based inheritance. If you like that approach, you'd also benefit from reading Apple's iOS documents, especially the UIKit documents. A lot of the ideas for iOS apps are transferrable to backbone.js if you are using ideas similar to those in Chaplin.

=== Original Answer ====

After posting this answer, I was asked by Jeremy Ashkenas if I would like to help maintain the Backbone.js wiki. While I will keep my answer below, you should check the backbone.js wiki for the most recent information:

Official Backbone.js Resources

Startups/Apps Built on Backbone.js

Example Apps

OpenSource/Github Projects

Blog Posts & Tutorials

Backbone.js Google Group -

See question on Quora

Posted on 7 March 2011

What are the most important JavaScript concepts to know for a job interview?

You will want to understand, or at least have a passing familiarity with:

  • Closures (seconding Kevin Dangoor)
  • Prototype Inheritance (ibid.)
  • The Module Pattern
  • Aspect Oriented Programming (aka "Duck Punching")
  • Asynchronous Programming
  • Function Expressions vs. Function Declarations
  • For client-side development -- the major inconsistencies between various implementations of the Document Object Model (the infamous DOM).

See question on Quora

Posted on 11 February 2011

What companies have the best team of JavaScript programmers?

Google.  One thing not mentioned yet is that Google Maps is incredibly impressive, and it was truly groundbreaking when it came out.  Between GMail, Google Maps, and other crazy projects like Wave, the Closure Compiler, GWT, v8, etc., I think Google probably needs to be near the top of the list.

280 North.  Objective-J is a little bit crazy but also kind of brilliant.  The handful of applications I've seen made with it are all really well done.

Asana.  Lunascript looks really promising, and the people I know who work there are really excellent programmers, and I know they've been pushing the limits of what current browsers can do with JS.

I agree with Yahoo and Facebook and Mozilla.  Microsoft probably has a bunch of very good people as well just because they are so large.  I would mention Lala too but they were acquired.

See question on Quora

Posted on 5 May 2010

What is the best way to educate yourself on HTML, CSS, JavaScript, and AJAX?

Doing beats simply reading every time so: go build a single-page site, now, then improve it as you learn.

Other resources: is a solid starting point, and reading the docs and faqs (and learning about why it includes what it does) is educational. is excellent for best practices and advanced topics. is a great tool to try things out. is excellent. has a fantastic, long list of tons of additional resources.

Finally, while I agree with many of the other answers to this question, I have to disagree strongly with those who have recommended is NOT a trustworthy resource. Its owners are SEO experts and prominently rank for most webdev-related searches, but the quality and accuracy and depth of their content is badly lacking. The awesome people at explain why to avoid w3schools:

We are passionate about the web, learning, and craftsmanship.
We want you, as web designers and developers, to be successful in your careers. We feel, though, that W3Schools is harming the community with inaccurate information. Like any other authoritative educational resource, W3Schools should both hold itself to, and be held to, the highest standards.
We hope we can illuminate why W3Schools is a troublesome
resource, why their faulty information is a detriment to the web, and what you (and they) can do about it.


See question on Quora

Posted on 30 March 2010 search results

Understanding Javascripts role in development.

I have been a developer for a very long time, and I am struggling to understand what is happening with Javascript these days. I was always under the impression that javascript being clientside meant that it was mostly utilized for the interface. Lately I have been reading about react, node and a couple of other libraries and I am struggling to understand javascripts place in the world.

I am still using a backend language to do my data work, sometimes PHP, Python, and or .NET depending upon the client. I am doing mostly visual representation and a fair amount of form validation in javascript.

What is javascripts role in modern program development?

submitted by Bonejob to javascript
[link] [48 comments]

Posted on 20 March 2015

I'm making an RPG in JavaScript! Without canvas! Yes, I'm an idiot!

Update: I got a test version of the current build up and running if anyone wants to check it out!

Controls: Up/W, Down/D, Left/A, Right/D, Enter/Spacebar

Hello there! I am a budding JavaScript developer looking to make a name for himself (read: find employment), and so I decided making an RPG might be a fun way to test out my skills. It's far from finished, but I think I'm far along enough that I can share with people, and hopefully get some feedback!

The GitHub repo:

I'm also getting into the habit of making write-ups of the process:

I don't have screenshots, but here's a really quick video I posted just recently:

I'm posting in /r/javascript primarily to get some constructive criticism on the code aspect of it, not so much the game design aspect. Also, this is technically my first GitHub repo, so if I messed up the setup instructions in any way, let me know.

Any and all feedback is welcome!

Edit #1: A clarification! I work primarily as a front-end developer and UI/UX designer. Hence, my DOM-only approach. I'm using this project as a way to hone my DOM manipulation skills, and have a little bit of fun while doing it!

Edit #2: After some of your feedback, I'm definitely going to refactor some of the code to stop relying on jQuery as a kind of framework.

Edit #3: Thanks for all the support, everyone! There's a lot of really good advice on this thread, and I'm gonna do my best to put it to good use!

submitted by robobeau to javascript
[link] [126 comments]

Posted on 12 August 2014

Do JavaScript app developers typically use object-oriented javascript?

I'm a Java Developer and i'm about to learn JavaScript and AngularJS. Do folks that make full-blown enterprise apps with things like AngularJS tend to use a lot of object-oriented JavaScript or not? I don't find the object oriented features of JavaScript to be very intuitive (i.e. prototypes etc). Do folk actually make a lot of prototypes and use inheritance etc?

submitted by vt97john to javascript
[link] [57 comments]

Posted on 14 July 2014

Why do so many Javascript libraries get this wrong?

And why does no one notice?

All too often I see a promising Javascript library follow this approach to creating classes:

function Library(a, b) { this.publicMethod = function() { return a + b; }; ...etc... } 

Instead of the superior prototypical way:

function Library(a, b) { this.a = a; this.b = b; } Library.prototype = { constructor: Library, publicMethod: function() { return this.a + this.b; } }; 

For those of you who don't understand the difference, in the first (non-prototypical) approach, every time you initialise a new Library object you also unnecessarily recreate every single method. If your class is instantiated a lot and/or has a large number of methods, this will lead to much heavier memory consumption. The other approach only creates the Library methods once to be reused in different contexts (the typical inheritance model), which is much better for memory.

Now the average jQuery plugin isn't going to see a whole lot of decrease in memory consumption by using the prototypical approach, but how has it not been the standard this whole time? It's clearly the intended way of creating anything like a class in Javascript.

I remember years back when I first started learning Javascript, every tutorial I found taught the former approach. I didn't even hear the word prototype until years later. Yet after all these years with Javascript maturing as it has I still run into recent GitHub projects that base it around the obviously inferior design approach. And no one even mentions it in the issues, even on ones with thousands of users and hundreds of contributors.

Maybe I'm missing something here...

EDIT: It seems I've stumbled upon quite a controversial topic in the Javascript community. A lot of really great points here, let's just try to not downvote comments only because we don't agree with them.

EDIT 2: It seems the general consensus is that they each have their appropriate uses. My views have definitely been challenged and I recognise that my opinion was a little flawed. This has been an excellent discussion, thank you!

submitted by poisondwarf to javascript
[link] [116 comments]

Posted on 2 April 2014

Is the option to disable Javascript in browsers outdated?

Do you think the option to turn Javascript off in most browsers is outdated?

It seems like more and more of elements of the user experience that users really like and find really useful, necessary, are dependent on Javascript. AJAX is the best example.

All of that gets bollixed up if someone shuts Javascript off. Yes, the programmer can detect if Javascript is enabled, but it seems out of date for browser makers to give the users the ability to shut off a major.....close to being a defacto standard technology, s/he may need.

submitted by cyanocobalamin to javascript
[link] [99 comments]

Posted on 12 August 2013

What are your vanilla JavaScript knowledge standards that every JS developer should know?

I have an interview coming up for a front end position. I have used JavaScript while at uni for the last 2.5 years and am familiar with Modular JavaScript and other design patterns. Also am familiar with scoping in JavaScript and ...inheritance.

What other things would you recommend I brush up on? Your help would really be appreciated!

submitted by js_coder to javascript
[link] [230 comments]

Posted on 7 August 2013

My javascript game as native application for Android, Windows / Linux / OSX

I will be writing some "How to" articles soon but for now I would like to share what I consider finished work - and spawn a few initial thoughts on different platforms / systems.

Quick vine/video of the game if you are wondering is it worth reading.

Link to the game is at the bottom of post - because I mostly want to share my bitter-sweet joy after spending 500+ hours on this title.

Technical details:

  • Done with canvas - supported by my unfortunately named library Canvas Query
  • No DOM/CSS rendering
  • Sound based on Audio element (no WebAudio API)
  • GamepadAPI - w3c/chrome specification

Windows / Linux / Osx - node-webkit

Very pleasant to work - absolutely nothing has to be tweaked. Managed to do both windows and linux packages under Ubuntu (using WINE). Unfortunately for Mac you need OSX. Also you need special build for OSX < 10.7 - alsooooooo your app will not get accepted in Ubuntu Store for Ubuntu > 12 because of some dependencies craziness

Android / IOS - CocoonJS

Everything goes rather smooth if you are creating the game with cocoon in mind from the start - no DOM, first canvas element is screen, some traps like audio.load - pros is that it is WAY faster (thanks to OpenGL) than PhoneGap and other solutions - also you don't need OSX, nor developers account in development process. Cons are that you will loose your hair searching for bugs that are not in your code.

I have failed to make port for IOS because imageData related functions are not working properly - also it kill the app randomly for some reason - also context.arc is broken on IOS.

CocoonJS will support Gamepad API which makes it possible to make OUYA games. If you can't get your game working on IOS - ejecta is an alternative.

Firefox OS

Deploying application is the easiest of all platforms - you just upload some manifest file and voila - no porting at all. However the OS is still too slow to render more complex games like QbQbQb - tho I've been able to run different one in built-in browser (which performance is no-different from native apps) with promising results (but that's not the topic).


Currently my game is available on Humble (bundle) Store and Google play store, Newgrounds, Kongregate. Pending approval for Desura. Rejected by GOG and Rovio stars. Will be trying greenlight. However this is marketing - I am failing hard in this field so won't play wise guy :)

One advice: do not put DEMO in title on Kongregate - even if it is true :) They like/ask to be cheated by disguising demo as a normal version - and then full game is called "SUPER" or "HD" despite it has all the same assets.

I will be trying to find time to reveal little by little details on publishing on different platforms - especially how to build packages for android, ubuntu or making windows installers because this is something that javascript programmer may find extremely repulsive (I DID... it breaks the whole idea of HTML5 portability with browser as a vessel - and I am not yet sure was it the best business decision).

Also to show you a glimpse of how many twists are there check my distribution/ folder structure

The game:

|~o Click this o~|

Also - if you are currently porting html5 game and got stuck on something - ask - maybe I have encountered the same problem and managed to go through.

I will announce articles on /r/javascript but you can follow me on twitter or tumblr

submitted by rezoner to javascript
[link] [60 comments]

Posted on 4 August 2013

Javascript != Java

3rd-party contractor came to visit office yesterday, who has "decades" of experience. Conversation came up about JavaScript in one of our products. He says, "Our product doesn't use Java." After an awkward moment with someone who works on the knowledge base nodding in agreement with him, I speak up and delineate the difference between Java and JavaScript.

Later on in the conversation, the same 3rd-party guy followed up with this jewel: "besides, what would anyone even use JavaScript for on the web?"

I proceeded to disable Javascript in my browser and show him.

tl;dr: lasers, dinosaurs, & drums made a guy's head explode

[edit spelling]

submitted by raiderrobert to talesfromtechsupport
[link] [364 comments]

Posted on 22 May 2013

I'm trying to learn JavaScript, and all of the books I've looked at begin with a heavy dose of binary and memory allocation - is it really necessary to learn this??

I fully understand that in order to be a fantastic, brilliant programmer learning about how the computer converts your code and how much memory it takes to process it could be of benefit, but as a beginning programmer, I feel like it is a great waste of my time (for now) to know that the number 114 is made up of 64 bits. I'm feverishly trying to up my skill set so that I can move out of my horrific tech support job and into the world of programming, and in order to maximize my time, is it okay to skip over this or will it haunt me further down the line?

edit: Thank you for all the feedback, insight, and encouragement! I have ordered Professional JavaScript for Web Developers and The Definitive Guide from Amazon. They won't be here for another week, so in the meantime, I am 25 pages into homoiconic's book JavaScript Allonge (a very clever and informative read!) and I'm pressing on :)

submitted by have_u_restarted_it to javascript
[link] [131 comments]

Posted on 1 February 2013

If JQuery is so easy to implement, why learn vanilla javascript?

So im learning front end development as i go along, and i've been asked by some clients to include things like accordian and datepicker UI elements of JQuery. Im really struggling with the code academy exercises and am beginning to ask myself 'do i really need to learn vanilla javascript if everyones using libraries anyway?'. What possible use could vanilla have these days?

Also, should i be doing more than just doing the exercises on code academy? i.e read books on jscript/work on some sort of basic project?


Edit : Why downvote? I've been doing front end coding for 2 months now so i really dont know that much. Help a guy out!

Edit 2 : Some great posts here guys. Thanks for you input. In hindsight I maybe should have stated my aspirations ; I dont desire to be a programmer. I don't find writing code for the sake of it fun, HOWEVER, I do get inspired by browsing and seeing beautiful websites with such interactivity and fluidity. I want to be able to make visually stunning websites as opposed to soley being a 'programmer' in the traditional sense if you understand. Thanks again.

submitted by jsthrow to javascript
[link] [114 comments]

Posted on 8 November 2012

r/javascript is not Stack Overflow

I don't know how other users of r/javascript feel about this, but I think this should be a forum for discussion of Javascript itself and sharing interesting examples.

Every day new threads hit the top of the page which are just asking for help with, or critique of code. IMO, these kinds of posts belong in a different forum, preferably Stack Overflow, a link to which is posted right over there --->

Am I being a fusspot? How do other people feel about this?

submitted by mitchellrj to javascript
[link] [115 comments]

Posted on 23 October 2012

Learn Javascript

This subreddit is for anyone who wants to learn JavaScript or help others do so. Questions and posts about HTML and CSS are also encouraged. /r/LearnJavascript is sponsored by the folks at [Hack Reactor](, a school specializing in teaching Javascript to fledgling programmers. HR staff members regularly post and respond to questions here. [link]

Posted on 4 April 2012

What program do you use to write Javascript?

I hope you guys don't get this a lot. Currently I'm using Dreamweaver code mode, but there's got to be a better tool out there for OO Javascript right?

Edit: Thanks for the advice guys, I'm going to give a couple of these a shot.

Also, I was going to ask for some up-votes, so that this would be more prominent on /r/javascript, but then I remembered it was /r/javascript. 2 is enough.

submitted by 90yoboy to javascript
[link] [139 comments]

Posted on 9 August 2011

Recommendations for mastering JavaScript.

I'm making it a goal of mine to master JavaScript and was hoping someone else had done the same and wouldn't mind sharing their regime.

EDIT: ** **I've created a new post to host all the references from this post. Find it here.

EDIT: Thanks guys. I've compiled a list of references mentioned here. I appreciate all your contributions.

  1. Anything written by Douglas Crockford. This includes: JavaScript: The Good Parts and YUI Theater
  2. Read other people's code, jQuery source, Node's source, etc.
  3. Understand JavaScript before becoming dependent on libraries (eg. jQuery, Prototype).
  4. Addy Osmani's Javascript 101 audio course
  5. Build Things - "think of something cool, and try and build it."
  6. Participate at StackOverflow.
  7. References -o- plenty: Gecko DOM Reference, HTML and DHTML Reference, Yahoo! YUI Theater, HTML DOM Tutorial, Annotated ECMAScript 5.1, JavaScript, JavaScript Blog

  8. And finally, Lord loves a working' man, don't trust whitey, and see a doctor and get rid of it.

submitted by fl0at to javascript
[link] [93 comments]

Posted on 21 February 2011

Javascript is NOT a bad language

Venting here. I'm sick of hearing that Javascript is a bad language. It's not perfect (what language is?) but it is quick and easy to write clean, flexible and reusable code. It's extremely well documented. It has some sweet debugging tools (these days). I love the powerful dynamic nature of it, and the event driven programming that it enables. Occasionally I sit down with people that "used to do some Javascript back in the day", people who were left with a bad taste in their mouth. Together we (ok, mostly me) hash out some clean, concise, and readable Javascript... and I laugh as they slowly realize that they don't know as much about it as they thought they did.

I love Javascript. It's the web browsers that I usually have issues with.

submitted by spiderworm to javascript
[link] [83 comments]

Posted on 29 December 2010


All about the JavaScript programming language! [link]

Posted on 24 January 2008