当前位置:网站首页>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);
边栏推荐
- 新手问个问题,我现在是单机部署的,提交了一个sql job运行正常,如果我重启了服务job就没了又得
- mysql拆分字符串作为查询条件的示例代码
- Cloud native technology container knowledge points
- 监控界的最强王者,没有之一!
- Rust knowledge mind map XMIND
- Up to 5million per person per year! Choose people instead of projects, focus on basic scientific research, and scientists dominate the "new cornerstone" funded by Tencent to start the application
- A few suggestions for making rust library more beautiful! Have you learned?
- Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
- Detailed explanation of ThreadLocal
- Efficient ETL Testing
猜你喜欢
Efficient ETL Testing
Designed for decision tree, the National University of Singapore and Tsinghua University jointly proposed a fast and safe federal learning system
Les entreprises ne veulent pas remplacer un système vieux de dix ans
dockermysql修改root账号密码并赋予权限
How to choose indoor LED display? These five considerations must be taken into account
Dockermysql modifies the root account password and grants permissions
Introduction to network basics
Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)
NFTScan 开发者平台推出 Pro API 商业化服务
ICLR 2022 | pre training language model based on anti self attention mechanism
随机推荐
让我们,从头到尾,通透网络I/O模型
How to choose indoor LED display? These five considerations must be taken into account
Puppeter connects to the existing Chrome browser
Huawei cloud gaussdb (for redis) unveils issue 21: using Gauss redis to achieve secondary indexing
问下各位,有没有flink sql生成作业的文档啊或是案列啊知道flink cli可以建表和指定目
企业不想换掉用了十年的老系统
Efficient ETL Testing
asp读取oracle数据库问题
NFTScan 开发者平台推出 Pro API 商业化服务
Case recommendation: An Qing works with partners to ensure that the "smart court" is more efficient
European Bioinformatics Institute 2021 highlights report released: nearly 1million proteins have been predicted by alphafold
MySQL中正则表达式(REGEXP)使用详解
同构+跨端,懂得小程序+kbone+finclip就够了!
欧洲生物信息研究所2021亮点报告发布:采用AlphaFold已预测出近1百万个蛋白质
Introduction to network basics
Custom swap function
C three ways to realize socket data reception
实现多彩线条摆出心形
GPT-3当一作自己研究自己,已投稿,在线蹲一个同行评议
Cloud native technology container knowledge points