当前位置:网站首页>JS addition, deletion, modification and query of JSON array
JS addition, deletion, modification and query of JSON array
2022-07-06 23:14:00 【~Xinjiang】
Catalog
Query log . according to username Query log
Delete record . according to username Delete record
Modify the record . according to username modify password
Query log . according to username Query log

const users = [
{ username: " Zhang San ", password: 333 },
{ username: " Li Si ", password: 444 },
{ username: " Wang Wu ", password: 555 },
];
// Query log . according to username Query log
let data = users.filter((item) => item.username == " Zhang San ");
console.log(" according to username Queried records :", data);Delete record . according to username Delete record

const users = [
{ username: " Zhang San ", password: 333 },
{ username: " Li Si ", password: 444 },
{ username: " Wang Wu ", password: 555 },
];
// Delete record . according to username Delete record
let data = users.filter((item) => item.username == " Zhang San ");
console.log(" according to username Queried records :", data);
let index = users.indexOf(data[0]);
console.log(" Indexes index:", index);
index !== -1 && users.splice(index, 1);
console.log(" After deleting a record users:", users);Modify the record . according to username modify password

const users = [
{ username: " Zhang San ", password: 333 },
{ username: " Li Si ", password: 444 },
{ username: " Wang Wu ", password: 555 },
];
// Modify the record . according to username modify password
let data = users.filter((item) => item.username == " Zhang San ");
console.log(" according to username Queried records :", data);
data[0].password = 3333;
console.log(" After modifying a record users:", users);The new record .

const users = [
{ username: " Zhang San ", password: 333 },
{ username: " Li Si ", password: 444 },
{ username: " Wang Wu ", password: 555 },
];
// The new record .
users.push({ username: " Zhao Liu ", password: 666 });
console.log(" After adding a new record users:", users);边栏推荐
- Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)
- [compilation principle] LR (0) analyzer half done
- Dayu200 experience officer runs the intelligent drying system page based on arkui ETS on dayu200
- Cloud native (32) | kubernetes introduction to platform storage system
- Docker mysql5.7 how to set case insensitive
- flinksql select id ,count(*) from a group by id .
- [step on pit collection] attempting to deserialize object on CUDA device+buff/cache occupy too much +pad_ sequence
- 浅谈网络安全之文件上传
- 专为决策树打造,新加坡国立大学&清华大学联合提出快速安全的联邦学习新系统
- How does crmeb mall system help marketing?
猜你喜欢

CUDA exploration

What can be done for traffic safety?

Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget

动作捕捉用于蛇运动分析及蛇形机器人开发

Efficient ETL Testing

Cocoscreator+typescripts write an object pool by themselves

ACL 2022 | small sample ner of sequence annotation: dual tower Bert model integrating tag semantics

GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议

Dayu200 experience officer runs the intelligent drying system page based on arkui ETS on dayu200

Traversal of a tree in first order, middle order, and then order
随机推荐
同构+跨端,懂得小程序+kbone+finclip就够了!
cuda 探索
memcached
Use mitmproxy to cache 360 degree panoramic web pages offline
Is "applet container technology" a gimmick or a new outlet?
云原生(三十二) | Kubernetes篇之平台存储系统介绍
Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
Isomorphism + cross end, knowing applet +kbone+finclip is enough!
B站大佬用我的世界搞出卷积神经网络,LeCun转发!爆肝6个月,播放破百万
What can be done for traffic safety?
问下各位,有没有flink sql生成作业的文档啊或是案列啊知道flink cli可以建表和指定目
这个『根据 op 值判断操作类型来自己组装 sql』是指在哪里实现?是指单纯用 Flink Tabl
OpenSSL: a full-featured toolkit for TLS and SSL protocols, and a general encryption library
[compilation principle] LR (0) analyzer half done
PDF批量拆分、合并、书签提取、书签写入小工具
自动更新Selenium驱动chromedriver
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
同一个作业有两个source,同一链接不同数据库账号,为何第二个链接查出来的数据库列表是第一个账号的
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
MATLAB小技巧(27)灰色预测