当前位置:网站首页>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);
边栏推荐
- None of the strongest kings in the monitoring industry!
- 案例推荐丨安擎携手伙伴,保障“智慧法院”更加高效
- What can be done for traffic safety?
- Word2vec (skip gram and cbow) - pytorch
- Why are some people still poor and living at the bottom of society even though they have been working hard?
- Slide the uniapp to a certain height and fix an element to the top effect demo (organize)
- Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi
- 基于PaddlePaddle平台(EasyDL)设计的人脸识别课堂考勤系统
- How to achieve text animation effect
- Balanced Multimodal Learning via On-the-fly Gradient Modulation(CVPR2022 oral)
猜你喜欢
#DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)
MySQL实现字段分割一行转多行的示例代码
Word2vec (skip gram and cbow) - pytorch
云原生(三十二) | Kubernetes篇之平台存储系统介绍
借助这个宝藏神器,我成为全栈了
Cocoscreator+typescripts write an object pool by themselves
企業不想換掉用了十年的老系統
(shuttle) navigation return interception: willpopscope
Pdf batch splitting, merging, bookmark extraction, bookmark writing gadget
Dockermysql modifies the root account password and grants permissions
随机推荐
European Bioinformatics Institute 2021 highlights report released: nearly 1million proteins have been predicted by alphafold
#DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)
dockermysql修改root账号密码并赋予权限
Realize colorful lines and shape your heart
Hard core observation 545 50 years ago, Apollo 15 made a feather landing experiment on the moon
监控界的最强王者,没有之一!
C three ways to realize socket data reception
动作捕捉用于蛇运动分析及蛇形机器人开发
Thinkphp5 multi table associative query method join queries two database tables, and the query results are spliced and returned
Dayu200 experience officer homepage AITO video & Canvas drawing dashboard (ETS)
MATLAB小技巧(27)灰色预测
Isomorphism + cross end, knowing applet +kbone+finclip is enough!
Children's pajamas (Australia) as/nzs 1249:2014 handling process
How to choose indoor LED display? These five considerations must be taken into account
允许全表扫描 那个语句好像不生效set odps.sql.allow.fullscan=true;我
B站大佬用我的世界搞出卷积神经网络,LeCun转发!爆肝6个月,播放破百万
Uniapp setting background image effect demo (sorting)
Automatically update selenium driver chromedriver
Gpt-3 is a peer review online when it has been submitted for its own research
cuda 探索