Skip to content

Latest commit

 

History

History
36 lines (20 loc) · 2.54 KB

TASKS.md

File metadata and controls

36 lines (20 loc) · 2.54 KB
  1. Write a JavaScript program that takes two args and calculates multiplication and division of two numbers (Extra credit: Create simple html inputs with multiply and divide buttons and display result on screen).

  2. Define a function sum() and a function multiply() that sums and multiplies (respectively) all the numbers in an array of numbers. For example, sum([1,2,3,4]) should return 10, and multiply([1,2,3,4]) should return 24.

  3. Define a function maxOfThree() that takes three numbers as arguments and returns the largest of them.

  4. Write a function that takes a single character and returns true if it is a vowel, false otherwise.

  5. Write a function translate() that will double every consonant and place an occurrence of "o" in between. For example, translate("this is fun") into the string "tothohisos isos fofunon".

  6. Define a function reverse() that computes the reversal of a string. For example, reverse("cat food") should return the string "door tac".

  7. Write a function to sort a list of words (an array) in alphabetical order.

  8. Write a function findLongestWord() that takes an array of words and returns the length of the longest one.

  9. Write a function filterLongWords() that takes an array of words and an integer i and returns the array of words that are longer than i.

  10. Write a function charFreq() that takes a string and builds a frequency listing of the characters contained in it. Represent the frequency listing as a Javascript object. Try it with something like charFreq("abbabcbdbabdbdbabababcbcbab").

  11. 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.

  12. Write a JavaScript function which accepts one argument and returns the type. Note : There are six possible values that typeof returns: object, boolean, function, number, string, and undefined.

  13. Write a JavaScript function which will take an array of numbers stored and find the second lowest and second greatest numbers, respectively.

  14. Write a JavaScript function that returns array elements larger than a number.

  15. Write a JavaScript conditional statement to sort three numbers. Display an alert box to show the result.

  16. Write a JavaScript for loop that will iterate from 0 to 15. For each iteration, it will check if the current number is odd or even, and display a message to the screen.

  17. Write a JavaScript program to find the most frequent item of an array. Sample array : var arr1=[3, 'a', 'a', 'a', 2, 3, 'a', 3, 'a', 2, 4, 9, 3]; Sample Output : a ( 5 times )