First, let's know a little bite about palindrome?
A palindrome is a word or number which reads the same backward as forward.
Project overview
This is an application, that can find your birthday is palindrome or not. if your birth date is not a palindrome, It'll show you a message, your birth date is a palindrome, or if not, then the message will be how many days it got missed as well as show the nearest palindrome date.
Tech stack used for this project
- HTML
- CSS
- JavaScript
GitHub
Live
Explanation
Create a HTML file in which we're going to add HTML elements to build website layout div, nav, footer, form, input button, etc.
Create a CSS file for styling HTML documents.
Create a JavaScript file to write the logic for the Palindrome date. The Project logic is divided into the following steps to understand in a better way.
Step1: So, After creating the HTML and CSS part of this project, we'll write JavaScript logic for this project.
Step2: Select form and input element by using document.querySelector(" "). You can select form element this way also document.forms[0], and store days of month in a varibale.
Step3: Create a function that returns a reverse string.
Here,
The Split("") method splits the string into an array.
- reverse() The reverse method reverses the order of an array.
- The join("") method returns an array as a string.
Step4: Create a function checks date is palindrome or not.
Step5: Create a function that converts from number to string.
Step5: Create a function that returns an array of all possible formates of a date, such that
[ddmmyyyy, mmddyyyy, yyyymmdd, ddmmyy, mmddyy, yymmdd]
Step6: Create a function that checks palindrome for all possible date formats.
Step7: Create a function that checks year is leap or not.
Step:8 Create a function that finds the next palindrome date, returns in an object.
Step:9 In the final step, addEventListener to form element with submit method.
Thank You.