如何映射arraylist的特定属性
我正在寻找一种方法来从我的 postList 列表中获取所有电子邮件属性来过滤授权的最大字符数,问题是我真的不知道如何从 postList 映射电子邮件属性...
const postList = [
{"postId": 1, "id": 1, "email": "[email protected]"},
{"postId": 1, "id": 2, "email": "[email protected]"},
{"postId": 1, "id": 3, "email": "[email protected]"},
{"postId": 1, "id": 4, "email": "[email protected]"},
]
const onlyEmailValid = []
for (let i = 0; i < postList.length; i++) {
if(postList.email.value.length > max_chars) {
console.log("email : " + postList.email + " has too long");
continue
}
onlyEmailValid.push(postList[i]);
}
console.log(clearJobList);
I m looking a way to get all email property from my postList list to filtering max chars authorized, the problme is i don't know really how mapping email property from postList...
const postList = [
{"postId": 1, "id": 1, "email": "[email protected]"},
{"postId": 1, "id": 2, "email": "[email protected]"},
{"postId": 1, "id": 3, "email": "[email protected]"},
{"postId": 1, "id": 4, "email": "[email protected]"},
]
const onlyEmailValid = []
for (let i = 0; i < postList.length; i++) {
if(postList.email.value.length > max_chars) {
console.log("email : " + postList.email + " has too long");
continue
}
onlyEmailValid.push(postList[i]);
}
console.log(clearJobList);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您好尝试使用
filter
方法Hello try to use
filter
method