Question: Create only one JavaScript file which must be called STUDENT_ID-functions.js . (200198097) All the functions you implement must be placed in STUDENT_ID-functions.js and you are

  • Create only one JavaScript file which must be called STUDENT_ID-functions.js. (200198097)
  • All the functions you implement must be placed in STUDENT_ID-functions.js and you are not allowed to use any external file or library. Using an extra file or library will produce a zero mark for your assignment.
  • Based on the last two digits of your student id, you are required to implement the following functions
  • Student ID last two digits: 51 to 99
  1. Write a function that returns a string containing random characters where the length must be equal to the value of the parameter. // function(5) // return lduem; // 5 is the argument passed and 5 is the length of the random character string which is returned

  1. Write a function which returns the calling string value converted to upper case. // function("alphabet "); // return "ALPHABET"

  1. Write a function which adds the equal amount (numSpace) of whitespace (numSpace) to both ends of the receiving string. // function(str, numSpace) // fn(hello, 2); // returns hello

  1. Write a function to change the case of all the characters in the string (str) parameter to its opposite case (upper / lower) when the character position matches the value of the pos parameter. function(str, pos [even|odd]). Example function(abCd, odd) return Abcd) => a is 1st, b is 2nd, c is 3rd and d is 4th

  1. Write a function to return the reversed version of the string it receives as an argument. function(str) example function("abc") return "cba" (similar built-in function reverse).

  1. Write a function which combines two strings which are passed as parameters. Mix one character from each string and return the concatenated result. function('ABC','Defg') return ADBeCfg

  1. The trimLeft() method removes whitespace from the left end of a string. Whitespace in this context is all the whitespace characters (spaces, tabs, and newlines.) function("\t value ") //return "value "

  1. Write a function which removes whitespace from both ends of the receiving string. Whitespace in this context is all the whitespace characters (spaces, tabs, and newlines.) function(" value\t ") //return "value"

  1. Write a function to concatenate 2 arrays and return a new array.

//function([1,2],[3,4]) //return [1,2,3,4], (Note: same functionality as

Array.concat )

  1. Write a function that accepts an array and a value. Check every element of the given array against a given value. Return true if the array elements are bigger than the provided value. // function( [5,10],
    1. // false // function([6,10],5) // true, (Note: similar functionality as

Array.every )

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!