SHARE
TWEET

Untitled

a guest May 7th, 2019 94 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Exercises:
  2. JS Functions
  3.  
  4. 1. Write a JavaScript function that returns a passed string with letters in alphabetical order. Go to the editor
  5. Example string : 'webmaster'
  6. Expected Output : 'abeemrstw'
  7. Assume punctuation and numbers symbols are not included in the passed string.
  8.  
  9.  
  10. 2. Write a JavaScript function that accepts a string as a parameter and converts the first letter of each word of the string in upper case. Go to the editor
  11. Example string : 'the quick brown fox'
  12. Expected Output : 'The Quick Brown Fox '
  13.  
  14.  
  15. 3. Write a JavaScript function that accepts a string as a parameter and find the longest word within the string. Go to the editor
  16. Example string : 'Web Development Tutorial'
  17. Expected Output : 'Development'
  18.  
  19.  
  20. 4. Write a JavaScript function that accepts a string as a parameter and counts the number of vowels within the string. Go to the editor
  21. Note : As the letter 'y' can be regarded as both a vowel and a consonant, we do not count 'y' as vowel here.
  22. Example string : 'The quick brown fox'
  23. Expected Output : 5
  24.  
  25.  
  26. 5. Write a JavaScript function that accepts a number as a parameter and check the number is prime or not. Go to the editor
  27. Note : A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself.
  28.  
  29. JS Objects
  30.  
  31. 6.
  32. Write a JavaScript program to display the reading status (i.e. display book name, author name and reading status) of the following books. Go to the editor
  33.  
  34. var library = [
  35.    {
  36.        author: 'Bill Gates',
  37.        title: 'The Road Ahead',
  38.        readingStatus: true
  39.    },
  40.    {
  41.        author: 'Steve Jobs',
  42.        title: 'Walter Isaacson',
  43.        readingStatus: true
  44.    },
  45.    {
  46.        author: 'Suzanne Collins',
  47.        title:  'Mockingjay: The Final Book of The Hunger Games',
  48.        readingStatus: false
  49.    }];
  50.  
  51. Validation
  52.  
  53. 1. Write a JavaScript function to validate whether a given value type is boolean or not.
  54.  
  55. 2. Write a JavaScript function to validate whether a given value type is NaN or not.
  56.  
  57. 3. Write a JavaScript function to validate whether a given value type is null or not.
  58.  
  59. 4. Write a JavaScript function to validate whether a given value is number or not.
  60.  
  61. 5. Write a JavaScript function to validate whether a given value is object or not.
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top