Menu

Write Loop Get Values Ll Object Grades Add 10 Values Written Instructions Create Function Q43801066

How can I write a for-in loop to get all values that’ll be inthe object grades and add 10 to any and all values.

Written Instructions:

Create a function called curveGrades that increments each valuein an Object by 10

  • 1 parameter: grades – an Object ofsubject:grade pairs
  • returns: the grades object after each gradehas been incremented by 10

How to create this function:

  • Use a for-in loop to iterate over grades
  • Use Bracket Notation to increment the value of each grade by 10using <current grade> += 10;
  • After the loop return grades

passes: 2 failures: 1 duration: 0.02s 100% 1 function curveGrades (grades) { 2 // YOUR CODE BELOW HERE // 3 for (var i in gra

passes: 2 failures: 1 duration: 0.02s 100% 1 function curveGrades (grades) { 2 // YOUR CODE BELOW HERE // 3 for (var i in grades) { curve Grades() ✓ should exist X should increment each value in the input object by 10 5 6 7 } i = grades.value; grades[i] += 10; AssertionError: expected { a: 10, b: 20, c: 30, undefined: NaN } to deeply equal { a: 20, b: 30, C: 40 } 9 10 11 } return grades; // YOUR CODE ABOVE HERE // ✓ should return the original grades object Run Submit Auto-Run OFF Reset Show transcribed image text passes: 2 failures: 1 duration: 0.02s 100% 1 function curveGrades (grades) { 2 // YOUR CODE BELOW HERE // 3 for (var i in grades) { curve Grades() ✓ should exist X should increment each value in the input object by 10 5 6 7 } i = grades.value; grades[i] += 10; AssertionError: expected { a: 10, b: 20, c: 30, undefined: NaN } to deeply equal { a: 20, b: 30, C: 40 } 9 10 11 } return grades; // YOUR CODE ABOVE HERE // ✓ should return the original grades object Run Submit Auto-Run OFF Reset

Expert Answer


Answer to How can I write a for-in loop to get all values that’ll be in the object grades and add 10 to any and all values. Writte…

OR