December 16th, 2013, 08:41 AM
-
Date Object !
Code:
function getSeason(obj){
var month = obj.getMonth();
var day = obj.getDay();
if (mon < 2 || (mon == 2 && day < 20)){
return "winter";
}
else if(mon < 5 || (mon == 5 && day <21)){
return "spring";
}
else if(mon < 8 || (mon == 8 && day <23)){
return "summer";
}
else if(mon < 11 || (mon == 11 && day <22)){
return "Fall";
}
else{
return "winter";
}
}
var today = new Date();
document.write(getSeason(today));
why this code is not running ? not even in Alert(); function. It dont display anything just nothing
December 16th, 2013, 08:58 AM
-
Yeah, you set "month" to the month, then in your comparisons, you use "mon" ...
var month = obj.getMonth();
if (mon < 2
Last edited by badger_fruit; December 16th, 2013 at 09:01 AM.
"For if leisure and security were enjoyed by all alike, the great mass of human beings who are normally stupefied by poverty would become literate and would learn to think for themselves; and when once they had done this, they would sooner or later realise that the privileged minority had no function and they would sweep it away"
- George Orwell, 1984
December 16th, 2013, 11:34 AM
-
aaaaaaaaaaaaaaaaaaaaaa programmmingggggggggggg
December 16th, 2013, 11:41 AM
-
Hahaha, yeah, it's great isn't it!
Did you fix it now?
"For if leisure and security were enjoyed by all alike, the great mass of human beings who are normally stupefied by poverty would become literate and would learn to think for themselves; and when once they had done this, they would sooner or later realise that the privileged minority had no function and they would sweep it away"
- George Orwell, 1984
December 17th, 2013, 03:23 PM
-
yeah got it ... know any book for OOP in JAVASCIRPT ??
badger_fruit