It's time to put all your JavaScript skills to the test to build an app combining everything you've learned about JavaScript so far. In this assignment, you are required to build 10 functions.
• Reverse engineering functions found in JavaScript with the intention of defining them yourself
• Write decision-making statements and control structures to solve problems
• Apply programming logic to solve basic to intermediate problems
• Testing and debugging
In this assignment, you are going to create a JavaScript file containing 10 functions. Each function represents one step and 10 marks are assigned to each step (function). The functions you are creating might be very similar to a built-in function found predefined in the JavaScript language. Each function needs to be considered as an individual problem. Focus on each function one problem at a time until all 10 functions are defined. There are two versions of the assignment. The last two digits of your student id determine the set of steps you must implement. Check the what to implement section of this document for more details.
• Create only one JavaScript file which must be called STUDENT_IDfunctions.js.
• All the functions you implement must be placed in STUDENT_IDfunctions.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
1. 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.
2. Write a function which returns the calling string value converted to lowercase. //function("ALPHABET"); // return "alphabet"
3. 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).
4. 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
5. 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)
6. 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"
7. 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)
8. 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"
9. 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 )
10.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 )