当前位置:网站首页>[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
}
边栏推荐
- If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
- Best practice case of enterprise digital transformation: introduction and reference of cloud based digital platform system security measures
- JS convert pseudo array to array
- 取得PMP證書需要多長時間?
- [path planning] RRT adds dynamic model for trajectory planning
- Five papers recommended for the new development of convolutional neural network in deep learning
- How to save your code works quickly to better protect your labor achievements
- Actual combat simulation │ JWT login authentication
- 业务实现-日志写到同一个行数据里面
- Summary of week 22-07-02
猜你喜欢
Skills in analyzing the trend chart of London Silver
P3304 [sdoi2013] diameter (diameter of tree)
企业公司项目开发好一部分基础功能,重要的事保存到线上第一a
XML的解析
【雅思阅读】王希伟阅读P3(Heading)
S32 design studio for arm 2.2 quick start
使用快解析搭建自己的minecraft服务器
巩固表达式C# 案例简单变量运算
Using fast parsing intranet penetration to realize zero cost self built website
OSEK standard ISO_ 17356 summary introduction
随机推荐
Advanced template
Is the account opening link of Huatai Securities with low commission safe?
Consolidated expression C case simple variable operation
S32 design studio for arm 2.2 quick start
If you open an account of Huatai Securities by stock speculation, is it safe to open an account online?
Instructions for go defer
如果炒股开华泰证券的户,在网上开户安全吗?
abc 258 G - Triangle(bitset)
GDB常用命令
JS 将伪数组转换成数组
【雅思阅读】王希伟阅读P4(matching2段落信息配对题【困难】)
端口映射和端口转发区别是什么
[kotlin] the third day
JS how to realize array to tree
OSEK standard ISO_ 17356 summary introduction
[IELTS reading] Wang Xiwei reading P4 (matching1)
Life is changeable, and the large intestine covers the small intestine. This time, I can really go home to see my daughter-in-law...
Expand your kubecl function
【雅思阅读】王希伟阅读P4(matching1)
The pit of sizeof operator in C language