'white belt' category


How to write constants in javascript

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 [...]

Read the complete article...

3 ways of creating functions in javascript

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 an instance of the Function class this way.
[source:javascript]
var [...]

Read the complete article...

What are javascript prototypes? (longer answer)

[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 [...]

Read the complete article...

How to create objects in object-oriented javascript

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 many times its ease of use and great encapsulation. In this paper, I won’t talk about [...]

Read the complete article...

5 reasons to write object-oriented (oo) javascript

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 explain [...]

Read the complete article...