/JS-Assignment

Final Project for JS class

Primary LanguageHTML

JS-Assignment

Final Project for JS class

  1. Write a function to return a string that contains random numbers where the length must be equal to the value of the parameter. ▪ E.G. function(5) returns 10243
  2. Write a function which returns the calling string value converted to lowercase. ▪ E.G. function("ALPHABET"); // returns " alphabet"
  3. Write a function which adds a specified amount of whitespace to the end of the string. ▪ E.G. function(“MyString”,3) returns “MyString ”
  4. Write a function that accepts a string and returns an array of its character codes in reverse ordered ▪ E.G. function("abc") returns [99, 98, 97]
  5. Write a function which combines the two strings it receives at the specified index of the first string. ▪ E.G. function('ABC','Defg', 1) returns ADefgBC
  6. Write a function that makes the following calculation: param1 + param2 - param3 + param4 – param5…and keeps with this pattern. You need to use JavaScript arguments object to determine the number of parameters. ▪ E.G. function(11,2,30,45,57) returns -29
  7. Write a function to return an array of unique elements from two array arguments. ▪ E.G. function([1,2, 4,3,6],[2,4,5,3]) returns [1,5,6]’, (Note: similar functionality as Array.concat )
  8. Write a function that accepts an array and a value and checks every element from given array against given value and returns true if array elements are smaller than given value. ▪ E.G. function( [2,4], 5) returns true ▪ E.G. function([5,10],5) returns false (Note: similar functionality as Array.every )
  9. Write a function to return a string that contains random lowercase alphabetic characters where the length must be equal to the value of the parameter. The second parameter contains an array of letters to omit. E.G. function(8,[t,b]) returns “eicdiofd”

10.Write a function that accepts 3 arrays and returns a string of duplicate elements in ascending order. Return all alphabetic characters in lowercase. E.G. function ([ 1,2,3,d], [5, 3, 0, a], [A,d,9] returns “3,d”

                ***FORBIDDEN TO USE BELOW!!!***
      String built-in functions  &  Array built-in functions

endsWith() includes() indexOf() lastIndexOf() localeCompare() match() repeat() replace() search() slice() split() startsWith() substr() substring() toLocaleLowerCase() toLocaleUpperCase() toLowerCase() toString() toUpperCase() trim() trimLeft() trimRight() valueOf() concat() copyWithin() every() fill() filter() find() findIndex() forEach() indexOf() isArray() join() lastIndexOf() map() pop() push() reduce() reduceRight() reverse() shift() slice() some() sort() splice() toString() unshift() valueOf()