小编Imt*_*Nur的帖子

How to create an array with the headers of a list in typescript?

In typescript, I have an array of objects. I want to create a new array with the headers of the objects from the first array.

    let scores = [{name: "A", skills: 50, result: 80},
                  {name: "B", skills: 40, result: 90},
                  {name: "C", skills: 60, result: 60}];

    let parameters = Array.from(this.scores.keys());
    this.console(parameters);

    // parameters = [0, 1, 2]

    // expecting; parameters = ["name", "skills", "result"]
Run Code Online (Sandbox Code Playgroud)

javascript typescript

1
推荐指数
1
解决办法
35
查看次数

标签 统计

javascript ×1

typescript ×1