Add new attachment

Only authorized users are allowed to upload new attachments.

This page (revision-10) was last changed on 15-Apr-2016 14:22 by BlakeMcBride

This page was created on 25-Oct-2014 08:46 by BlakeMcBride

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Difference between version and

At line 11 changed one line
| String | 'Hello'
| String | 'Hello' (prefer this form)
At line 18 added one line
| NaN | not a number
At line 20 added 2 lines
| Object (JSON) | {firstName:"John", lastName:"Doe", age:50, eyeColor:"blue"}
| Array | {{{[33, 'Dog', 55.6]}}}
At line 40 changed one line
"null" is also a constant that means no value
false, null, undefined, NaN, 0, and "" are all treated as "false". Anything else is treated as "true".
At line 59 changed one line
Variables are local to the context in which they are declared. This means if you declare it outside of a function, it is global. If you declare it inside a function it is local to that function. Keep all variables as local as possible.
Variables are either global or local to the function in which they are declared. This means if you declare it outside of a function, it is global. If you declare it inside a function it is local to that function. Keep all variables as local as possible. {} blocks do not establish a variable context / scope in JavaScript.
At line 79 changed one line
Another way to create a function is through a variable syntax. Although you may think "what good is that?", it is extremely important, and it opens the door to some very, very important things. The above function can also be defined as follows:
Another, equivalent, way to create a function is through the variable syntax. Although you may think "what good is that?", it is extremely important, and it opens the door to some very, very important things. The above function can also be defined as follows:
At line 145 changed one line
! Object
! Objects
At line 202 added one line
!! Classes
At line 204 added 5 lines
{{{
function MyClass(init) {
this.iv1 = init;
this.iv2 = 0;
}
At line 210 added one line
MyClass.cv1 = 101;
At line 212 added 66 lines
MyClass.getCV1 = function() {
return MyClass.cv1;
}
MyClass.setCV1 = function(val) {
MyClass.cv1 = val;
}
MyClass.prototype.getIV1 = function() {
return this.iv1;
}
MyClass.prototype.setIV1 = function(val) {
this.iv1 = val;
}
var x = new MyClass(36);
var y = new MyClass(42);
print(x.getIV1());
print(y.getIV1());
print(MyClass.cv1);
x.setIV1(44);
y.setIV1(22);
MyClass.setCV1(202);
print(x.getIV1());
print(y.getIV1());
print(MyClass.getCV1());
}}}
! Inheritance
{{{
function Mammal(name) {
this.name = name;
}
Mammal.prototype.getName = function() {
return this.name;
}
function Cat(name, color) {
Mammal.call(this, name); // call the super constructor to inherit its instance vars
this.color = color;
}
Cat.prototype = Object.create(Mammal.prototype); // copy parent prototype to
// inherit its methods
// this must be done before
// assigning local methods
Cat.prototype.getColor = function() {
return this.color;
}
var a = new Cat("Woolfy", "Brown");
print(a.getName());
print(a.getColor());
}}}
Version Date Modified Size Author Changes ... Change note
10 15-Apr-2016 14:22 6.239 kB BlakeMcBride to previous
9 18-Dec-2015 08:39 6.226 kB BlakeMcBride to previous | to last
8 04-May-2015 09:37 6.208 kB BlakeMcBride to previous | to last
7 12-Jan-2015 18:30 6.04 kB BlakeMcBride to previous | to last
6 12-Jan-2015 18:28 6.039 kB BlakeMcBride to previous | to last
5 12-Jan-2015 12:33 4.779 kB BlakeMcBride to previous | to last
4 12-Jan-2015 12:27 4.667 kB BlakeMcBride to previous | to last
3 12-Jan-2015 09:41 4.542 kB BlakeMcBride to previous | to last
2 25-Oct-2014 09:02 4.442 kB BlakeMcBride to previous | to last
1 25-Oct-2014 08:46 0.012 kB BlakeMcBride to last
« This page (revision-10) was last changed on 15-Apr-2016 14:22 by BlakeMcBride