Code Monkey home page Code Monkey logo

dp-888 / javascript-problems Goto Github PK

View Code? Open in Web Editor NEW

This project forked from aiturganorozmamatova/javascript-problems

0.0 0.0 1.0 11 KB

JavaScript programming problems (basics) [An editor is available at the bottom of the page to write and execute the scripts.] 1. Write a JavaScript program to display the current day and time in the following format. Sample Output : Today is : Tuesday. Current time is : 10 PM : 30 : 38 2. Write a JavaScript program to print the contents of the current window. 3. Write a JavaScript program to get the current date. Expected Output : mm-dd-yyyy, mm/dd/yyyy or dd-mm-yyyy, dd/mm/yyyy 4. Write a JavaScript program to find the area of a triangle where lengths of the three of its sides are 5, 6, 7. 5. Write a JavaScript program to rotate the string 'w3resource' in right direction by periodically removing one letter from the end of the string and attaching it to the front. 6. Write a JavaScript program to determine whether a given year is a leap year in the Gregorian calendar. 7. Write a JavaScript program to find 1st January is being a Sunday between 2014 and 2050. 8. Write a JavaScript program where the program takes a random integer between 1 to 10, the user is then prompted to input a guess number. If the user input matches with guess number, the program will display a message "Good Work" otherwise display a message "Not matched". 9. Write a JavaScript program to calculate days left until next Christmas. 10. Write a JavaScript program to calculate multiplication and division of two numbers (input from user). Sample form : 11. Write a JavaScript program to convert temperatures to and from Celsius, Fahrenheit. [ Formula : c/5 = (f-32)/9 [ where c = temperature in Celsius and f = temperature in Fahrenheit ] Expected Output : 60°C is 140 °F 45°F is 7.222222222222222°C 12. Write a JavaScript program to get the website URL (loading page). 13. Write a JavaScript exercise to create a variable using a user-defined name. 14. Write a JavaScript exercise to get the extension of a filename. 15. 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. 16. Write a JavaScript program to compute the sum of the two given integers. If the two values are same, then returns triple their sum. 17. Write a JavaScript program to compute the absolute difference between a specified number and 19. Returns triple their absolute difference if the specified number is greater than 19. 18. 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. 19. Write a JavaScript program to check a given integer is within 20 of 100 or 400. 20. Write a JavaScript program to check from two given integers, if one is positive and one is negative. 21. 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. 22. Write a JavaScript program to remove a character at the specified position of a given string and return the new string. 23. 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. 24. 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. 25. Write a JavaScript program check if a given positive number is a multiple of 3 or a multiple of 7. 26. Write a JavaScript program to create a new string from a given string taking the last 3 characters and added at both the front and back. The string length must be 3 or more. 27. Write a JavaScript program to check if a string starts with 'Java' and false otherwise. 28. Write a JavaScript program to check if two given integer values are in the range 50..99 (inclusive). Return true if either of them are in the said range. 29. Write a JavaScript program to check if three given integer values are in the range 50..99 (inclusive). Return true if one or more of them are in the said range. 30. Write a JavaScript program to check if a string "Script" presents at 5th (index 4) position in a given string, if "Script" presents in the string return the string without "Script" otherwise return the original one. 31. Write a JavaScript program to find the largest of three given integers. 32. Write a JavaScript program to find a value which is nearest to 100 from two different given integer values. 33. Write a JavaScript program to check if two numbers are in range 40..60 or in the range 70..100 inclusive. 34. Write a JavaScript program to find the larger number from the two given positive integers, the two numbers are in the range 40..60 inclusive. 35. Write a JavaScript program to check a given string contains 2 to 4 numbers of a specified character. 36. Write a JavaScript program to check if the last digit of the three given positive integers is same. 37. Write a JavaScript program to create new string with first 3 characters are in lower case. If the string length is less than 3 convert all the characters in upper case. 38. Write a JavaScript program to check the total marks of a student in various examinations. The student will get A+ grade if the total marks are in the range 89..100 inclusive, if the examination is "Final-exam." the student will get A+ grade and total marks must be greater than or equal to 90. Return true if the student get A+ grade or false otherwise. 39. Write a JavaScript program to compute the sum of the two given integers, If the sum is in the range 50..80 return 65 other wise return 80. 40. Write a JavaScript program to check from two given integers if either one is 8 or their sum or difference is 8. 41. Write a JavaScript program to check three given numbers, if the three numbers are same return 30 otherwise return 40 and if two numbers are same return 20. 42. Write a JavaScript program to check if three given numbers (integers) are increasing in strict mode and flag is "false", however if "true" is false the numbers will in soft mode. Note: Strict mode -> 10, 15, 31 : Soft mode -> 24, 22, 31 or 22, 22, 31 43. Write a JavaScript program to check from three given numbers (non negative integers) that two or all of them have the same rightmost digit. 44. Write a JavaScript program to check from three given integers that if a number is greater than or equal to 20 and less than one of the others. 45. Write a JavaScript program to check two given integer values and return true if one of the number is 15 or if their sum or difference is 15. 46. Write a JavaScript program to check two given non-negative integers and if one of the number (not both) is multiple of 7 or 11. 47. Write a JavaScript program to check if a number in the range 40..10000 inclusive presents in two number (in same range). For example 40 presents in 400 and 4000 48. Write a JavaScript program to reverse a given string. 49. Write a JavaScript program to replace every character in a given string with the character following it in the alphabet. 50. Write a JavaScript program to capitalize the first letter of each word of a given string. 51. Write a JavaScript program to convert a given number to hours and minutes. 52. Write a JavaScript program to convert the letters of a given string in alphabetical order. 53. Write a JavaScript program to check if the characters a and b are separated by exactly 3 places anywhere (at least once) in a given string. 54. Write a JavaScript program to count the number of vowels in a given string. 55. Write a JavaScript program to check if a given string contains equal number of p's and t's present. 56. Write a JavaScript program to divide two positive numbers and return a string with properly formatted commas. 57. Write a JavaScript program to create a new string of specified copies (positive number) of a given string. 58. Write a JavaScript program to create a new string of 4 copies of the last 3 characters of a given original string. The length of the given string must be 3 and above. 59. Write a JavaScript program to extract the first half of a string of even length. 60. Write a JavaScript program to create a new string without the first and last character of a given string. 61. Write a JavaScript program to concatenate two strings except their first character. 62. Write a JavaScript program to move last three character to the start of a given string. The string length must be greater or equal to three. 63. Write a JavaScript program to create a string using the middle three characters of a given string of odd length. The string length must be greater or equal to three. 64. Write a JavaScript program to concatenate two strings and return the result. If the length of the strings are not same then remove the characters from the longer string. 65. Write a JavaScript program to test if a string end with "Script". The string length must be greater or equal to 6. 66. Write a JavaScript program to display the city name if the string begins with "Los" or "New" otherwise return blank. 67. Write a JavaScript program to create a new string from a given string, removing the first and last characters of the string if the first or last character are 'P'. Return the original string if the condition is not satisfied.

HTML 51.17% JavaScript 48.83%

javascript-problems's People

Contributors

aiturganorozmamatova avatar

Forkers

prashanth393

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.