On 1 Mar 2007, at 20:03:30, Mordechai Peller wrote:

Nick Fitzsimons wrote:

window.onload = function() {
   var year = new Date().getFullYear();
   var text = "© " + year + " myplace");
   var p = document.createElement("p");
   p.appendChild(document.createTextNode(text));
   document.getElementById("testdiv").appendChild(p);
}


I would shorten it by one line since "year" isn't needed:

var text = "© " + (new Date()).getFullYear() + " myplace");

Agreed, but I tend to avoid early optimisation when writing examples, as I think they should go step-by-step to make it easier for people to follow. On the other hand, I'd completely abandoned that principle by the last two lines :-)

Regards,

Nick.
--
Nick Fitzsimons
http://www.nickfitz.co.uk/





*******************************************************************
List Guidelines: http://webstandardsgroup.org/mail/guidelines.cfm
Unsubscribe: http://webstandardsgroup.org/join/unsubscribe.cfm
Help: [EMAIL PROTECTED]
*******************************************************************

Reply via email to