On Oct 29, 11:36 am, Cartoper <carto...@gmail.comwrote:
I have this book "Beginning JavaScript for Practical Web Development,
Including AJAX" and in it the author is using javascript syntax I
don't understand. It is
<class name>={
That is an example of object literal notation that results in an
object being assigned to a (global) variable.
There are no classes in javascript (i.e. ECMAScript Language Ed 3)
although "class" is a future reserved word and there are plans to
introduce classes in the next version of ECMAScript. It is best not
to think of classes in regard to javascript, it just makes life more
difficult. You can emulate certain features of classes that exist in
other languages, however that does not make classes exist in
javascript.
All variables should be declared with var, though some are lazy and
don't bother for global variables. To me, it is much better to
explicity declare them:
var <object name= { ... };
It makes maintenance easier.
<function name>:function(params)
{
},
That creates a property called <function nameof the object <object
nameand assigns it a value of the function expression. You can call
it with:
<object name>.<function name>();
[...]
Are these static functions of the class DOMhelp or is something else
going on? Can someone provide me with a link that will expain this
notiation to me?
<URL:
http://www.crockford.com/javascript/private.html >
--
Rob