Javascript 这里是我只需要Id:1数据。一些Id';s没有值和一些Id';我们有另一个价值观

Javascript 这里是我只需要Id:1数据。一些Id';s没有值和一些Id';我们有另一个价值观,javascript,arrays,angular,Javascript,Arrays,Angular,请查找以下数据。这里是我只需要Id:1数据。有些Id没有值,有些Id有其他值 实际数据: data: [ 0: {Id: "1", DoctorId: "61", CreatedBy: "1", CreatedDate: "2020-06-25T00:00:00.000Z",…} 1: {Id: "2", DoctorId: "61", CreatedBy: &

请查找以下数据。这里是我只需要Id:1数据。有些Id没有值,有些Id有其他值

实际数据:

data: [
    0: {Id: "1", DoctorId: "61", CreatedBy: "1", CreatedDate: "2020-06-25T00:00:00.000Z",…}
    1: {Id: "2", DoctorId: "61", CreatedBy: "1", CreatedDate: "2020-06-26T00:00:00.000Z",…}
    2: {Id: "3", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-24T00:00:00.000Z",…}
    3: {Id: "1", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-24T19:24:00.000Z",…}
    4: {Id: "1", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-25T11:15:00.000Z",…}
    5: {Id: "", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-07-07T12:15:00.000Z",…}
    6: {Id: "", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-25T11:15:00.000Z",…}
    7: {Id: "", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-07-07T12:15:00.000Z",…}
    ]
我需要这样的输出

data: [
    0: {Id: "1", DoctorId: "61", CreatedBy: "1", CreatedDate: "2020-06-25T00:00:00.000Z",…}
    1: {Id: "1", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-24T19:24:00.000Z",…}
    2: {Id: "1", DoctorId: "61", CreatedBy: null, CreatedDate: "2020-06-25T11:15:00.000Z",…}
    ]

只需使用
Array.filter
即可过滤所需数据

欲知详情——

比如说-

const modifiedData = data.filter(item => item.id === 1);
console.log(modifiedData);
使用下面的代码

data.filter(x=>x.id == 1);

到目前为止,您尝试了哪些代码?作为一个拥有63k+rep的用户,即使已经回答了数百个类似的琐碎问题,我也希望至少有一个快速演示的答案。没错@MichaelD,但我试图对OP发布的内容进行排序,例如,但是JSON中有很多错误,所以懒惰跳过了这一部分。我的错。@MichaelD:如果用户根本不回答这样的问题就更好了。它现在已被合法关闭。