Posted on April 27, 2007, 6:45 am, by Dan, under
white belt.
Javascript has a pretty basic Date object. It is cool but not as cool as in other languages. In fact, it is different but we like it anyway. The primitive value A date is nothing else than the number of millisecond since January 1, 1970 00:00:00. So now is 1 177 603 737 358. When [...]
This one will be widely accepted. The problem with it is that it’s so obvious that the question is asked here and there. Javascript is not secure I repeat : javascript is not secure. Your code is readable and it can be modified by anyone. It is great when you want to do a bookmarklet. [...]
I already said Do not use the style property on HTML objects and as I was thinking how bad the innerHTML property can be, I considered doing an article on that subject. The problem was that stones were thrown at me after the first “Do not” article. Now I fear that this one may be [...]
I see a lot of person talking about how ajax is cool and it helps you doing things that you couldn’t do before it was “invented”. What most of these people don’t know is that most of the coolest features are not ajax. Ajax is just a way to communicate between a client and a [...]
Since ajax, a lot of people have to create HTML on the fly depending on response of the request. One mistake that I see a lot is that people are using the style property of their HTML objects. Why shouldn’t I do it? The style property has a precedence on every style Because the style [...]
YOU CAN’T. As simple as that. Anyway, what is a constant? A constant is a unchangeable variable that throws an error when you try to write in it. Thus, implementing constant in javascript would be against its will to be opened. The magic of javascript resides in the liberty it gives you to change anything [...]
In javascript, all functions are an instance of the class Function (with a capitalized F). The old way Everybody knows how to do it. In fact most languages do it this way. Boring but you can’t write javascript without knowing it. [source:javascript] function f() { } [/source] The uppercase F way You can directly create [...]
[I've also written the short answer (for advanced javascripters)] Javascript is using prototypes and is the only language I know that is doing it. What is the idea behind it? Simple. With prototypes, you can extend (add methods/properties) any class you want anywhere you want anytime you want even if you are not the owner [...]
[UPDATE : This post is outdated. Check out the new post on how to create objects.] Javascript is a functional programming language thus having no “real” objects. You can write it the way you want : procedural spag, functional, object or whatever word you know. Why should I write it object-oriented? Because, OO has proven [...]
To write hard as a rock javascript, the first thing you need to do is to object-orient your code. I do not mean to have a class structure that could stand the passage of a sandstorm in the Sahara but a light and useful structure that will let you work elegantly. This article does not [...]