Skip to content

Latest commit

 

History

History
61 lines (31 loc) · 2.8 KB

21-date-number-exercise.md

File metadata and controls

61 lines (31 loc) · 2.8 KB

Date & Number exercise

Question 1 : How can you convert a string to a number in JavaScript? write all the ways.

Question 2 : How do you round a number to a certain number of decimal places in JavaScript?

Question 3 : How can you generate a random number between two values in JavaScript?

Question 4 : How do you convert a number to a binary, octal, or hexadecimal format in JavaScript?

Question 5 : How do you add or subtract a certain number of days from a date in JavaScript?

Question 6 : How do you compare two dates in JavaScript? Check if a date is small or large or equal to other date?

Question 7 : How can you format a date in JavaScript according to the user's locale?

Question 8 : How do you calculate the difference between two dates in JavaScript?

Question 9 : How do you check if a year is a leap year in JavaScript?

Question 10 : How do you convert a string to a date in JavaScript? Write all ways?

Question 11 : How can you parse a date from a string in a specific format in JavaScript?

Question 12 : How can you get the time in a specific timezone in JavaScript?

Question 13 : Print date and time after every 1 second in the format 'MM/DD/YYYY HH:MM:SS'

Question 14 : Write a JavaScript function to get the number of days in a month. Pass month and year as an arugment to the function. for example : getDays(2, 2023).

Question 15 : Write a JavaScript function to get the week day name for the given date.

Question 16 : Write a JavaScript function to get the month name from the given date

Question 17 : Write a JavaScript function to check if given date is on weekend or not (Saturday/Sunday).

Question 18 : Ask your about his date of birth. Now write a JavaScript function to calculate age based on the given date of birth.

Question 19 : Write a Javascript function to using setInterval to show alert box when date is your birth date.

Question 20 : Show your birth date in Arabic.

Question 21 : Show your birth date in Chinese.

Question 22 : Write a JavaScript function to convert a binary number to a decimal number.

Question 23 : Write a JavaScript function to convert a decimal number to binary, hexadecimal or octal number.

Question 24 : Write a JavaScript function to find the highest value in an array using Math.max

Question 25 : Write a JavaScript function to find the highest value in an array using Math.min

Question 26 : Write a JavaScript function to check whether a value is an integer or not.

Question 27 : Write a JavaScript function to convert a positive number to negative number or to negativie number to positive number.

Question 28 : Convert 50 litre to Hindi locale and chinese locale.

Question 29 : Create a function to convert any number to given currency.

Question 30 : Write a JavaScript program to find the missing number from a given array. There are no duplicates in the list. Start from 1.