Javascript Object push() function

后端 未结 7 2106
借酒劲吻你
借酒劲吻你 2020-11-28 02:35

I have a javascript object (I actually get the data through an ajax request):

var data = {};

I have added some stuff into it:



        
相关标签:
7条回答
  • 2020-11-28 03:37

    Javascript programming language supports functional programming paradigm so you can do easily with these codes.

    var data = [
        {"Id": "1", "Status": "Valid"},
        {"Id": "2", "Status": "Invalid"}
    ];
    var isValid = function(data){
        return data.Status === "Valid";
    };
    var valids = data.filter(isValid);
    
    0 讨论(0)
提交回复
热议问题