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
- 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
- Write a function which returns the calling string value converted to upper case. // function("alphabet "); // return "ALPHABET"
- 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
- 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
- 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).
- 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
- 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 "
- 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"
- 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 )
- 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],
- // false // function([6,10],5) // true, (Note: similar functionality as
Array.every )
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
