I am getting one error. I am using javascript some method to reject some duplicate value but getting syntax error.I am explaining my code below.
var outputList = [];
for (var i = 0; i < specialImages[0]['special'].length; i++) {
if (!outputList.some(x => x.image === specialImages[0]['special'][i].image)) {
var data = {
image: specialImages[0]['special'][i].image,
gallery_image: specialImages[0]['special'][i].gallery_image,
comment: specialImages[0]['special'][i].comment
};
outputList.push(data);
}
In the above code i am getting this error in this if (!outputList.some(x => x.image === specialImages[0]['special'][i].image))
line. Please help me to resolve this error.
Maybe your user agent does not support arrow functions.
Replace arrow function
if (!outputList.some(x => x.image === specialImages[0]['special'][i].image)) {
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
with classic function
if (!outputList.some(function (x) { return x.image === specialImages[0]['special'][i].image; })) {
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.