Sei sulla pagina 1di 1

JavaScript Exercises

1- Write a JavaScript program to display the current day and time in the following format.
Sample Output: Today is: Friday.
Current time is: 4 PM: 50: 22
See JavaScript date type here
https://www.w3schools.com/jsref/jsref_obj_date.asp
2- Write a JavaScript program to find the area of a triangle where lengths of the three of its
sides are 5, 6, 7.
3- Write a JavaScript program to calculate multiplication and division of two numbers
(input from user).

Input box value reading examples:


https://www.w3schools.com/jsref/prop_text_value.asp
4- Write a JavaScript program to get the difference between a given number and 13, if the
number is greater than 13 return double the absolute difference.
Absolute value example:
https://www.w3schools.com/jsref/jsref_abs.asp
5- Write a JavaScript program to compute the sum of the two given integers. If the two
values are same, then returns triple their sum.
6- Write a JavaScript program to check two given numbers and return true if one of the
number is 50 or if their sum is 50.
7- Write a JavaScript program to create a new string adding "Py" in front of a given string.
If the given string begins with "Py" then return the original string.
8- Write a JavaScript program to remove a character at the specified position of a given
string and return the new string.
9- Write a JavaScript program to create a new string from a given string changing the
position of first and last characters. The string length must be greater than or equal to 1.
10- Write a JavaScript program to create a new string from a given string with the first
character of the given string added at the front and back.

Potrebbero piacerti anche