Please complete the following tasks and post them on the tapaScript Discord under "40 Days of JavaScript".
DO NOT USE AI to FIND ANSWERS. If you are stuck, let's discuss it on DISCORD and learn. Also, please note that none of the answers need you to create any UI. Just focus on the logic building and print the output on the browser console.
- Take a number and find if the number is an odd or even number.
- Print the number and result in the console.
Let's check if you are eligible to get a driving license. The eligibility to get a driving licence is 18 years.
- Manage
ageas a variable. - Check if the age is elligible for a driving license and print it on the console accordingly.
Let's calculate how much you earn from your office.
- You get 12,300 rupees as your monthly salary.
- You get a 20% bonus on your annual salary.
- How much money do you make per annum as a CTC?
Red Light... Green Light... Let's Play!
- Create a
colorvariable. - Based on the color variable's value print in the console if a traveller needs to STOP or GO. The Red color is for STOP and the Green color is for GO.
Let's calculate how much you pay for electricity bills per month and annually.
- Create a
unitsvariable. Based on this value you will calculate the total electricity bill for a months. - If each day you consume the
unitsand each unit cost 150 rupees, how much will you be charged per month? - If there is a 20% discount on the annual payment, how much will you be charged for an annual payment?
Is 2025 a Leap Year?
- Take
yearas input. - Use the arithmetic operator and ternary operator to print if a year is a leap year or not.
Find the max number from the lot.
- Take three numbers and assign them to variables p, q, and r.
- Now find the maximum of these three numbers using the comparison operators.
A tricky one for you
- Create a variable
countand assign a value, say, 5. - Now use the Bitwise shift operator to make the number double.
- Print it on the console.