Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This assignment is in javascript. Code the Function Code a transform function that takes an object as a parameter. Calling transform(oldPointStructure) will return an object

This assignment is in javascript.

Code the Function

  1. Code atransformfunction that takes an object as a parameter. Callingtransform(oldPointStructure)will return an object withlowercaseletters as keys. The value for each key will be the points assigned to that letter.
  2. InitializenewPointStructureby setting it equal totransform(oldPointStructure).
  3. Hints:
  4. Recall thatfor...inloops iterate over the keys within an object.
  5. If you need a reminder of how to assign new key/value pairs, review therelevant sectionin theObjectsandMathchapter.
  6. To access the letter arrays withinoldPointStructure, use bracket notation (oldPointStructure['key']).
  7. To access a particular element within a letter array, add a second set of brackets (oldPointStructure['key'][index]), or assign the array to a variable and usevariableName[index].

Examples

1 2 3 4 5 6 console.log("Letters with score '4':", oldPointStructure['4']); console.log("3rd letter within the key '4' array:", oldPointStructure['4'][2]); let letters = oldPointStructure['8']; console.log("Letters with score '8':", letters); console.log("2nd letter within the key '8' array:", letters[1]); 

Console Output

Letters with score '4': [ 'F', 'H', 'V', 'W', 'Y' ] 3rd letter within the key '4' array: V Letters with score '8': [ 'J', 'X' ] 2nd letter within the key '8' array: X 

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_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

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

Get Started

Students also viewed these Programming questions