Subj : Re: Add and object to an array To : Mortifis From : echicken Date : Fri Jul 19 2019 11:10 am Re: Re: Add and object to an array By: Mortifis to echicken on Fri Jul 19 2019 09:47:27 Mo> const dupUser = dup_list.find(dup_list => dup_list.number === edit); Fat-arrow functions and implicit return are ES6 features, while we're still on 5.1 here. This means that you have to spell out 'function () {}' in full, and you must explicitly return a value. This won't work, but to illustrate the equivalent syntax: const dupUser = dup_list.find(function (e) { return e.number === edit; }); However our Array object does not have a 'find' method, which is also new, so that's a no-go. There are other ways to achieve this: var dupUser; for (var n = 0; n < dup_list.length; n++) { if (dup_list[n].number !== edit) continue; dupUser = dup_list[n]; break; } Or: var dupUser; dup_list.some(function (e) { if (e.number !== edit) return false; dupUser = e; return true; }); Or you could put a polyfill at the top of your script: Array.prototype.find = function (f) { var ret; var self = this; this.some(function (e, i) { if (!f(e)) return false; ret = self[i]; return true; }); return ret; } And then 'find' would be available on Array and my "this won't work" example above would actually work. In any of the above cases, dupUser will either be the element from your dup_list array, or it will be undefined. --- echicken electronic chicken bbs - bbs.electronicchicken.com þ Synchronet þ electronic chicken bbs - bbs.electronicchicken.com .