[Solved] Lab 3

30 $

File Name: Lab_3.zip
File Size: 47.1 KB

SKU: [Solved] Lab 3 Category: Tag:

Or Upload Your Assignment Here:


  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 firstName, middleName, 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={      'first':a         'second':b};}    function testTemplateLiterals(firstName,middleName,lastName){      return myName='${firstName},${middleName},${lastName}';}    function testMultilineStrings{  return   mySpell= `Uh-bare-toe.   AK-ee-oh.   AH-gwah-MEN-tee.   A-LAR-tey.`;}function testSortWithArrowFunction(a){ return a.sort((m,n)=>n-m);}}export {lab3}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[Solved] Lab 3
30 $