Code: Select all
var foo = {
x: 5,
y: 10
};Code: Select all
function foo()
{
this.x = 5;
this.y = 10;
}
var foo = new foo();Also... the code I'm reading contains this:
Code: Select all
this.something = $(something);Moderator: General Moderators
Code: Select all
var foo = {
x: 5,
y: 10
};Code: Select all
function foo()
{
this.x = 5;
this.y = 10;
}
var foo = new foo();Code: Select all
this.something = $(something);Ah sweet thanksWeirdan wrote:{} - it's called 'object literal'. There are no classes in js, only objects
$ is ordinary function. For example, in Prototype it's used as a shorthand for 'document.getElementById(something)'
You're a legend dude. I haven't read that no but it looks nice and to-the-pointmatthijs wrote:Dustin Diaz wrote about object notation recently. Don't know if you have seen this article? http://www.dustindiaz.com/json-for-the-masses/