Leap Year in Javascript (NEWBIE) -


howdy i've started working basic javascript.

write program accept year user , display whether year leap year or not.

the teacher has not been , don't know how should go coding, i'm not asking answer - link or referencing use learn how pretty darn puzzled.

below example of think sort of needs like, i've been doing js couple days please if you're going burn me remember that.

var year=prompt("please input year: ");  var remainder=year % 4     if remainder === 4          document.write("it not leap year.");         else document.write("it leap year.");   document.write("you entered: " ,year, "."); 

some pointers:

  • prompt returns string, not number. use parseint(year, 10) turn number.
  • if statements if (condition) { thendothis(); } else { dothis(); }
  • the remainder of dividing 4 cannot 4, definition
  • a year leap year if: 1) it's divisible 4 , 2) it's not divisible 100 unless 3) it's divisible 400. 2000 leap year, 2100 won't be. should working simple division 4 first, add rules.

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -