JavaScript
Basic Syntax
Variables
Data types
Numbers
Basic IO
Conditionals
Nested conditions
Git branches
GUI Tools for Git
Code style: Basics
Introduction to AI
Practice
Assignment
Back to core program
Week 2 Assignment
Task 1 - Leap Year Check
A leap year has 366 days instead of 365, with February receiving an extra day. Here are the rules for determining a leap year:
- A year is a leap year if it is divisible by 4
- However, if the year is divisible by 100, it is not a leap year
- Unless the year is also divisible by 400, in which case it is a leap year
Examples:
- The year 2028 is a leap year because it is divisible by 4
- The year 1900 is not a leap year because it is divisible by 100
- The year 2000 is a leap year because it is divisible by 400
Write a JavaScript application that gets a valid year from a prompt and prints one of the following outputs:
- "Yes, <YEAR> is a leap year"
- "No, <YEAR> is not a leap year"
- “Invalid year!”
Replace <YEAR> with the year provided by the user.
A Valid year is between 0 and 9999.
Task 2
Write a coin toss game
Submission
…
The HackYourFuture curriculum is licensed under CC BY-NC-SA 4.0 **

*https://hackyourfuture.net/*