this question has answer here:
- array.prototype.find() undefined 2 answers
i wrote code matches uploaded files relevant clientid's, , displays them in table show files being assigned clients. trouble tested on chrome , safari per job spec , works fine.
the problem doesn't work on ie due not supporting array.prototype.find()
, have asked compatible ie.
i have looked @ other questions, answers specific situation, giving examples of other ways looking for.
what best way achieve trying do?
var item = clientlist.find(function(item) { return item.uniqueid == clientid; });
you can create own find function, important part break loop when match element.
var data = [{id: 1, name: 'a'}, {id: 2, name: 'b'}]; function altfind(arr, callback) { (var = 0; < arr.length; i++) { var match = callback(arr[i]); if (match) { return arr[i]; break; } } } var result = altfind(data, function(e) { return e.id == 2; }) console.log(result)
Comments
Post a Comment