Lab 3 Solved

25.00 $

Click Category Button to View Your Next Assignment | Homework

You'll get a download link with a: . zip solution files instantly, after Payment


5/5 - (1 vote)
  1. Inside lab3.js, you will export a class named lab3. In this class you will implement the following functions:
  2. testDefaultParamtersThe function takes two parameters, and the second parameter is defaulted to 100
  3. The function returns a json object containing two attributes: ‘first’ and ‘second’The ‘first’ attribute of the return object is defined as the first parameter of the function
  4. The ‘second’ attribute of the return object is defined as the second parameter of the function
  5. testTemplateLiteralsThe function takes three parameters, a firstNamemiddleName, and lastName
  6. The function returns a string with the three parameters separated by commasThe parameters should be concatenated using ES6 string templates, not ES5 string addition!
  7. testMultilineStringsThe function takes no parameters
  8. The function returns a multi-line string that is at least 4 lines longThe content of the string is up to you!
  9. testSortWithArrowFunctionThe function takes an array of numbers as a parameter
  10. The function returns the array sorted with a custom comparator that sorts the numbers descending
  11. Use the .sort function of the array and pass in a custom comparatorThe comparator should be implemented as an arrow function using ES6 syntax
class lab3{

    function testDefaultParamters(a,b=100){
      return  json={

    function testTemplateLiterals(firstName,middleName,lastName){
      return myName='${firstName},${middleName},${lastName}';
    function testMultilineStrings{
   mySpell= `Uh-bare-toe.

function testSortWithArrowFunction(a){
 return a.sort((m,n)=>n-m);

export {lab3}