当前位置:网站首页>[error reporting] "typeerror: cannot read properties of undefined (reading 'split')“
[error reporting] "typeerror: cannot read properties of undefined (reading 'split')“
2022-07-05 00:09:00 【Blog Zhu hukang】
Report the wrong question
In the use of split() Method is divided into strings , The red information is as follows :Cannot read properties of undefined (reading ‘split‘)
Error reporting analysis
Before dividing the data , First judge whether the current data is empty ; If you don't judge the data , Can cause an exception . So in calling splid() Function before , You need to make a non empty judgment on the data that currently needs to be segmented ( Or call when the data is not empty ).
Error reporting solution
Before dividing the data , First judge whether the current data is empty ; If you don't judge the data , Can cause an exception . So in calling splid() Function before , You need to make a non empty judgment on the data that currently needs to be segmented ( Or call when the data is not empty ).
const imgUrl = "https://tu.cloud.cn/flower/flower-size.jpg?size=1800";
// When the data is not empty
if(imgUrl) {
// Intercept Then splice the new string
const newImgUrl = imgUrl.split('?')[0] + "?size=600";
console.log(newImgUrl); //https://tu.cloud.cn/flower/flower-size.jpg?size=600
}
边栏推荐
- go踩坑——no required module provides package : go.mod file not found in current directory or any parent
- 快解析——好用的内网安全软件
- [Peking University] tensorflow2.0-1-opening
- Instructions for go defer
- Build your own minecraft server with fast parsing
- JS how to realize array to tree
- 人脸识别5- insight-face-paddle-代码实战笔记
- C语言中sizeof操作符的坑
- Data on the number of functional divisions of national wetland parks in Qinghai Province, data on the distribution of wetlands and marshes across the country, and natural reserves in provinces, cities
- abc 258 G - Triangle(bitset)
猜你喜欢
Fast analysis -- easy to use intranet security software
The waterfall flow layout demo2 (method 2) used by the uniapp wechat applet (copy and paste can be used without other processing)
Significance of acrel EMS integrated energy efficiency platform in campus construction
机器人强化学习——Learning Synergies between Pushing and Grasping with Self-supervised DRL (2018)
P3304 [SDOI2013]直径(树的直径)
Parsing of XML
图解网络:什么是网关负载均衡协议GLBP?
Combien de temps faut - il pour obtenir un certificat PMP?
PMP证书续证流程
How to use fast parsing to make IOT cloud platform
随机推荐
It's too convenient. You can complete the code release and approval by nailing it!
Combien de temps faut - il pour obtenir un certificat PMP?
OSEK standard ISO_ 17356 summary introduction
PMP证书续证流程
Application of fire fighting system based on 3D GIS platform
[path planning] RRT adds dynamic model for trajectory planning
Summary of week 22-07-02
[paper reading] Tun det: a novel network for meridian ultra sound nodule detection
URL和URI
go踩坑——no required module provides package : go.mod file not found in current directory or any parent
Summer challenge brings you to play harmoniyos multi terminal piano performance
如何将自己的代码作品快速存证,已更好的保护自己劳动成果
基于三维gis平台的消防系统运用
The company needs to be monitored. How do ZABBIX and Prometheus choose? That's the right choice!
Is the account opening link of Huatai Securities with low commission safe?
Tester's algorithm interview question - find mode
45 year old professor, she threw two super unicorns
Acwing164. Accessibility Statistics (topological sorting +bitset)
S32 design studio for arm 2.2 quick start
IELTS examination process, what to pay attention to and how to review?