当前位置:网站首页>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);
边栏推荐
- Mysql 身份认证绕过漏洞(CVE-2012-2122)
- Devsecops software R & D security practice - release
- Huawei cloud gaussdb (for redis) unveils issue 21: using Gauss redis to achieve secondary indexing
- 云原生(三十二) | Kubernetes篇之平台存储系统介绍
- DockerMySQL无法被宿主机访问的问题解决
- 这个『根据 op 值判断操作类型来自己组装 sql』是指在哪里实现?是指单纯用 Flink Tabl
- cuda 探索
- docker mysql5.7如何设置不区分大小写
- Is the more additives in food, the less safe it is?
- NFTScan 开发者平台推出 Pro API 商业化服务
猜你喜欢
Modules that can be used by both the electron main process and the rendering process
C three ways to realize socket data reception
(shuttle) navigation return interception: willpopscope
(1)长安链学习笔记-启动长安链
Bipartite graph determination
DR-Net: dual-rotation network with feature map enhancement for medical image segmentation
(1) Chang'an chain learning notes - start Chang'an chain
DockerMySQL无法被宿主机访问的问题解决
Why are some people still poor and living at the bottom of society even though they have been working hard?
Enterprises do not want to replace the old system that has been used for ten years
随机推荐
儿童睡衣(澳大利亚)AS/NZS 1249:2014办理流程
Uniapp setting background image effect demo (sorting)
Cloud native technology container knowledge points
#DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)
Realize colorful lines and shape your heart
View
docker mysql5.7如何设置不区分大小写
Efficient ETL Testing
Motion capture for snake motion analysis and snake robot development
【全网首发】Redis系列3:高可用之主从架构的
【Unity】升级版·Excel数据解析,自动创建对应C#类,自动创建ScriptableObject生成类,自动序列化Asset文件
机器人材料整理中的套-假-大-空话
企业不想换掉用了十年的老系统
dockermysql修改root账号密码并赋予权限
three. JS gorgeous bubble effect
Is "applet container technology" a gimmick or a new outlet?
mysql拆分字符串作为查询条件的示例代码
Traversal of a tree in first order, middle order, and then order
docker中mysql开启日志的实现步骤
Redis 持久化机制