Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Introduction 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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Introduction 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 Goals and Outcomes 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 . Description 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 What to implement? Create only one JavaScript file which must be called STUDENT ID- functions.js All the functions you implement must be placed in STUDENT D functions.is 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: 00 to 50 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 conveted to lowercase. //function("ALPHABET"); f 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, char lochange, 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 fromlndex parameter. Returns -1 if the value is not found function(str,searchChar,fromlndex) (similar built-in function indexof) 5. 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(" valuelt ") /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 (alblc','1 return a','b,'c], (bcAbd, 'A, return [bc, 'bd'], (bacd, 'X' return [b','a', c','d]) (similar built-in function split) 7. 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" valuelt ") //return" value" 9. Write a function to return a unique concatenated array from 2 arrays //function([1,2],12,4]) /return [1,2,41', (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) l/return 15', (Note: similar functionality as Array.find) 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. I/ 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. I/ function("alphabet "); / return "ALPHABET 1. 2. 3. Write a function which adds the equal amount (numSpace) of whitespace (numSpace) to both ends of the receiving string. ! function(str, numSpace) II fn(hello", 2); I/ returns" hello " 4. 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 [evenjodd]). Example function (abCd', 'odd') return Abcd) a is 1st, b is 2nd, c is 3rd and d is 4th 5. 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 6. 7. 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" 8. 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(" valuelt ") /return "value" 9. Write a function to concatenate 2 arrays and return a new array //function([1,21,[3,4]) //return [1,2,3,4], (Note: same functionality as Array.concat) 10. 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. I/ function( [5,10] 5) /I false II function([6,10],5) II true', (Note: similar functionality as Array.every) Do not use function You are not allowed to use any of the built-in functions listed in the Do not use function section of this document. Using any of the following functions will result in String built-in functions endsWith) includes ) indexOf () lastIndexof ) LocaleCompare() match () repeat () replace () search () slice() split () startswith() substr() substring () toLocaleLowerCase ) toLocaleUpperCase () toLowerCase ) toString () toUpperCase () trim() valueOf trimLeft and trimRight Array built-in functions concat) copyWithin) every () fill () filter() find ) findindex () forEach () indexof ) sArray() join) lastIndexof ) map() pop () push () reduce() reduceRight () reverse ) shift () slice () some ) sort () splice) tostring () unshift) valueof ) Submission deadline and rules Due date: Must be posted on your GBleam account by Week 12: Satuiday, Maich 31, 2019 11:59 Late submission-20% per day Must use the Assignment tester before the assignment due date. Assignment tester will be teleased a week before chie date

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2018 Dublin Ireland September 10 14 2018 Proceedings Part 1 Lnai 11051

Authors: Michele Berlingerio ,Francesco Bonchi ,Thomas Gartner ,Neil Hurley ,Georgiana Ifrim

1st Edition

3030109240, 978-3030109240

More Books

Students also viewed these Databases questions

Question

List the components of the strategic management process. page 72

Answered: 1 week ago