Skip to content

Javascript and jQuery programming


After several months with almost writting a single line of Javascript, now it’s turn to play with it, and as you know its a language that I hate, yes, I really hate it!

Luckily thanks to jQuery, my productivity with this language is much better!

NOTE: WriteCodeOnline/JavaScript is not running anymore! You can try, another good alternative!

Programming in Javascript

The truth is that while coding in Python allow you to test your code on a console, in Javascript is more complex because you have to load the HTML page, which in turn has linked the Javascript code …. and of course, so no one can learn ! No specific IDE to program in Javascript, or a direct console where you see the code executed.

So, to improve the experience with Javascript, I’ve known the site, allowing me to easily write code and see the result. Normally I use to create small (or not so small) functions, with the advantage that how usually use Notepad++, I’m used to the text editor.

Testing WriteCodeOnline

Using this website to test code is great, especially combined with FireBug (extension for debugging) for code problems. The following example is a function to determine if the postal code of Spain (typically 4 or 5 digits) is correct with respect to the province (the postal code is usually PPXXX where PP is the code of the province, and XXX is assigned) .



As you can see, I have caused an error in this code that you can discover thanks to FireBug, so … my experience is pretty good, besides being an online tool, and I can see the result with document.write(valor).

JSFiddle, another cool alternative

Another cool alternative to write Javascript code online is JSFiddle, where you can also select libraries such jQuery, Prototype, YUI, …, apart of using CSS and HTML, all in the same site. I have used this site especially when my needs require Javascript or jQuery, for example, or also interoperate with HTML code

Javascript and jQuery patterns

Much of the blame for that hatred” of JavaScript comes from my lack of experience, or because …. everything is very simple in Python. Anyway, to get along better with Javascript, it’s useful to know some rules of this language (well, rules and Javascript …. does not match, je je). And it seems a little weird (programming level) that the same thing can be done using two completely different patterns, but they are the same. And of course, this very confusing for beginners.

Here you have an example of how to create a function, which you can use any of these four methods (yes, not one or two but four). So, to improve, here are this magnificent site where you have a large collection of patterns in JavaScript and jQuery: As you can see, in addition to code faster, also it shows the most correct, and several optimizations (in short, do the same in several different ways one mess !!).

Fortunately, I met typescript, a language of Microsoft trying to make it more affordable Javascript, and who devote a handful of entries in the coming weeks!

Finally, I hope that after reading this entry, you give a try the tools I normally use for writting and liking Javascript, a little more! je je!!

Happy coding!

Manejando Datos Newsletter

Noticias, entradas, eventos, cursos, … News, entrances, events, courses, …

Gracias por unirte a la newsletter. Thanks for joining the newsletter.