Kids riding unicycles

JavaScript is a unicycle

This past week, we learned JavaScript and jQuery. Before this I didn’t know the difference between the two languages, other than hearing people say jQuery is easier to work with.

How I see it

Let’s say you want to take a ride around the block. You have two “vehicles” from which to choose: a plain old bicycle, and a unicycle. JavaScript is the unicycle. It takes some time to learn to ride it and you might fall (a lot) and hurt yourself (a lot) in the process but, once you get the hang of it, you’ll feel really proud of for conquering something that many people would stay away from. Since JavaScript can be a bit tough to work with when all you want to do is ride around the block, remember that you have the option to ride the bicycle instead. jQuery is that bicycle; it’s built on JavaScript and makes doing what you want to do much easier.

Since jQuery is essentially JavaScript, everything done in jQuery can be done in JavaScript. But you wouldn’t always want to ride a unicycle.

I kept on pedalling and got lost

This weekend, I got really carried away with jQuery. I was writing a lot of what I think is probably very bloated, redundant, and very roundabout code. And that’s totally fine; it’s part of the learning process. Oh and I went to bed at 4 am.

Keep in mind, however, that if an effect you’d like to achieve can be done with CSS, do it in CSS. CSS is becoming increasingly powerful with features previously only achievable with JavaScript. And because it’s much easier to write CSS, this saves you time. There are performance-related reasons as well, but perhaps I’ll save that for another time.

In conclusion… let CSS do the heavy lifting, and leave the rest for JavaScript and jQuery.

Leave a comment