Move History

Fork Selected
  • Description

    I Have An Array With Type iType On Below Here

    interface iType { subject: string, point: number }

    const data: iType[] = [ { subject: "IPA", point: 70, }, { subject: "MTK, point: 65 } ];

    Can You Find The Value Of The data Above Using Following Formula:

    value = total_of_point / total_of_data;

    Code
    export interface iType {
      subject: string,
      point: number
    }
    
    export function valueResult (data: iType[]): number {
      let value = 0;
      // You Can Code Below Here
      
      return value;
    }
    Test Cases Failed
    // See https://www.chaijs.com for how to use Chai.
    import { assert } from "chai";
    
    import { valueResult, iType } from "./solution";
    
    const data: iType[] = [
      {
        subject: "IPA",
        point: 70,
      },
      {
        subject: "MTK",
        point: 65
      }
    ];
    
    describe("Checking Test Nagatech Basic #4", function() {
      it("Checking Test On Array Function", function() {
        assert.strictEqual(valueResult(data), 67.5)
      });
    });