Create only one JavaScript file which must be called STUDENT_ID-functions.js . All the functions you implement must
Fantastic news! We've Found the answer you've been seeking!
Question:
- Create only one JavaScript file which must be called STUDENT_ID-functions.js.
- 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 function
Student ID last two digits: 00 to 50
- Write a function which returns the sum of the values for each parameter it receives. You’ll need to use the JavaScript arguments object to determine the number of parameters.
- Write a function which returns the calling string value converted to lowercase. //function("ALPHABET"); // return "alphabet"
- Write a function that returns a subset of a string between one index and another. function(str, indexStart, indexEnd) Example
((‘abcd’,1,10) return ‘bcd’) Example 2 (‘abcd’,0 ,1) return ‘ab’) (similar built-in function substring or substr).
- Write a function that returns a new string containing all matches. Each match is then replaced by replacement characters. function(str, charToChange, charToReplace)
Example ((‘abc’,’a’,’X’) return Xbc
- Write a function that returns an index of the receiving string for the first occurrence of the specified character. Start the search with the fromIndex parameter. Returns -1 if the value is not found. function(str,searchChar,fromIndex) (similar built-in function indexof)
- Write a function which removes whitespace from both ends of the receiving string. Whitespace in this context is all whitespace characters (spaces, tabs, and newlines.) function(" value\t ") //return "value"
- Write a function which splits the receiving string parameter into an array of strings by separating the string into substrings and return the array. function (stringToSplit, separator) Example (‘a|b|c’, ‘|’ return [‘a’,’b’,’c’], (bcAbd, ‘A’, return [‘bc’, ‘bd’], (bacd, ‘X’ return [‘b’,’a’,’c’,’d’]) (similar built-in function split)
- The trimRight() method removes whitespace from the right end of a string. Whitespace in this context is all the whitespace characters (spaces, tabs, and newlines.) function(" value\t ") //return " value"
- Write a function to return a unique concatenated array from 2 arrays.
//function([1,2],[2,4]) //return [1,2,4]’, (Note: similar functionality as Array.concat )
- Write a function that accepts an array and a value to find and return the first element that is bigger than the given value.
//function([5,15,4],6) //return 15’, (Note: similar functionality as
Array.find )
Related Book For
Accounting Information Systems
ISBN: 978-0133428537
13th edition
Authors: Marshall B. Romney, Paul J. Steinbart
Posted Date: