当前位置:网站首页>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);边栏推荐
- Enterprises do not want to replace the old system that has been used for ten years
- 允许全表扫描 那个语句好像不生效set odps.sql.allow.fullscan=true;我
- Docker starts MySQL and -emysql_ ROOT_ Password = my secret PW problem solving
- 同构+跨端,懂得小程序+kbone+finclip就够了!
- Docker mysql5.7 how to set case insensitive
- spark调优(二):UDF减少JOIN和判断
- How to achieve text animation effect
- (flutter2) as import old project error: inheritfromwidgetofexacttype
- Precise drag and drop within a contentable
- Financial professionals must read book series 6: equity investment (based on the outline and framework of the CFA exam)
猜你喜欢

Rust knowledge mind map XMIND

CUDA exploration

Isomorphism + cross end, knowing applet +kbone+finclip is enough!

Unified Focal loss: Generalising Dice and cross entropy-based losses to handle class imbalanced medi

Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~

UE4 blueprint learning chapter (IV) -- process control forloop and whileloop

Cloud native technology container knowledge points

COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
MySQL实现字段分割一行转多行的示例代码

Cover fake big empty talk in robot material sorting
随机推荐
Gpt-3 is a peer review online when it has been submitted for its own research
Two week selection of tdengine community issues | phase II
Improving Multimodal Accuracy Through Modality Pre-training and Attention
QT signal and slot
Efficient ETL Testing
石墨文档:4大对策解决企业文件信息安全问题
docker中mysql开启日志的实现步骤
MATLAB小技巧(27)灰色预测
#DAYU200体验官# 首页aito视频&Canvas绘制仪表盘(ets)
AcWing 4299. Delete point
Children's pajamas (Australia) as/nzs 1249:2014 handling process
Jafka source analysis processor
#DAYU200体验官# 在DAYU200运行基于ArkUI-eTS的智能晾晒系统页面
使用MitmProxy离线缓存360度全景网页
Isomorphism + cross end, knowing applet +kbone+finclip is enough!
What does front-end processor mean? What is the main function? What is the difference with fortress machine?
(flutter2) as import old project error: inheritfromwidgetofexacttype
Windows auzre background operation interface of Microsoft's cloud computing products
「小程序容器技术」,是噱头还是新风口?
ICLR 2022 | pre training language model based on anti self attention mechanism