Book creator (disable)

Talk:JavaScript/Functions and Objects

From Wikibooks, the open-content textbooks collection

Jump to: navigation, search

Firefox 1.5 and Opera 8.5 shows 105 and 108 instead if 2005 and 2008 for the code:

 var mydate = new Date();
 document.write(mydate.getYear());
 document.write("<br><br>");
 mydate.setYear(2008);
 document.write(mydate.getYear());

That's why we should always use getFullYear() instead of getYear(), as recommended by


Perhaps there are some ideas and tips in http://c2.com/cgi/wiki?CategoryJavaScript we could paraphrase in this Wikibook, such as, for example, http://c2.com/cgi/wiki?PrivateVariablesInJavaScript .


Is there a place in this Wikibook for these techniques?


I don't find interjections like "That wasn't very hard, was it?" or "Don't let Bill Gates know -- he'll patent it!" to be helpful. To me they seem silly and childish -- but then I don't like the "Dummies" books either. What do other people think?

The following has been removed due to its condescending nature, and general lack of coherentness.

Now that wasn't very hard, was it? At this point, we are only using functions to save us some typing (actually, in the examples we used it is actually taking more typing - however, real-world programs will use the same function throughout the scripts.) When you learn about parameters, that's when functions really start to shine.

Pmw57 (talk) 13:04, 21 February 2009 (UTC)

The Classes section had the following at the start of some code:

var site = new Object(); //Required to not cause error in Internet Explorer
site = {};

As the error hasn't been able to be duplicated from IE3 to IE7, more details about the error need to be provided. The code now starts with

var site = {};

Pmw57 (talk) 00:27, 22 February 2009 (UTC)

[edit] merge

I suggest merging all of JavaScript/Functions into JavaScript/Functions and Objects. --DavidCary (talk) 03:43, 14 June 2009 (UTC)