简体   繁体   中英

Javascript filter function return different result in production

my code is :

audio_files = [{id: "78", isProfileImg: "1"},{id: "145", isProfileImg: "0"}];
console.log(audio_files.filter((x) => x.id == 78));

the result in dev machine

[{…}]
0: {id: "78", isProfileImg: "1"}
length: 1
__proto__: Array(0)

result in production

[{}]
0:length: 0
__proto__: Array(0)

have anyone faced the same issue?

  1. 在过滤之前检查数组长度,或者验证您的数据是否该特定 id 可用。

通过编辑 ID 检测脚本解决

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM