-
Description I Have An Array With Types From Interface iType
interface iType{ id: number, name: string, };
const data: iType[] = [ { id: 1 name: "Manny" }, { id: 2 name: "Danny" }, { id: 3 name: "Socciella" }, ];
Can You Show Only One Data From That Array By ID?
Code export interface iType{ id: number, name: string, } export function findData (data: iType[], selectedData: number): iType { // You Can Code Here }
Test Cases Failed // See https://www.chaijs.com for how to use Chai. import { assert } from "chai"; import { findData, iType } from "./solution"; const data: iType[] = [ { id: 1, name: "Manny" }, { id: 2, name: "Danny" }, { id: 3, name: "Socciella" }, ]; // TODO Add your tests here describe("Checking Test Nagatech Basic 3", function() { it("Status", function() { assert.strictEqual(findData(data, 1), data[0]); assert.strictEqual(findData(data, 2), data[1]); }); });
Output:
-
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
Please sign in or sign up to leave a comment.