1

We are creating an object that is used to validate data when it is passed to a validation function. We would like to provide a total value of the elements contained in the object.

var TestDataAmountsInitial = {
  "TestNumner1": 34.98,
  "TestNumner2": 10.00,
  "TestTotal": this.TestNumner1 + this.TestNumner2
};

// logging output 

it(`----------------------------------------`, () => {
    console.log("DEBUG: Test Data");
    console.log(`The Data: TestNumner1:  ${TestDataAmountsInitial.TestNumner1}`);
    console.log(`The Data: TestNumner2:  ${TestDataAmountsInitial.TestNumner2}`);
    console.log(`The Data: TestTotal:  ${TestDataAmountsInitial.TestTotal}`);
  });

// Console output 

DEBUG: Test Data
The Data: TestNumner1:  34.98
The Data: TestNumner2:  10
The Data: TestTotal:  NaN
lealceldeiro
  • 14,342
  • 6
  • 49
  • 80
macgowan
  • 71
  • 2
  • 10

0 Answers0