当前位置:网站首页>JS delete the last bit of the string
JS delete the last bit of the string
2022-07-02 06:50:00 【xuefankang】
1.substr() Method
var str = "abc,def,ghi,";
str = str.substr(0, str.length - 1);
console.log(str) // return abc,def,ghi
2.substring() Method
var str = "abc,def,ghi,";
str = str.substring(0, str.length - 1);
console.log(str) // return abc,def,ghi
3.lastIndexOf() Method
var str = "abc,def,ghi,";
str = str.substring(0, str.lastIndexOf(','));
console.log(str) // return abc,def,ghi
边栏推荐
- Fe - wechat applet - Bluetooth ble development research and use
- selenium备忘录:selenium\webdriver\remote\remote_connection.py:374: ResourceWarning: unclosed<xxxx>解决办法
- JS modification element attribute flipping commonly used in selenium's Web Automation
- Kali latest update Guide
- 20201025 visual studio2019 qt5.14 use of signal and slot functions
- Usage of map and foreach in JS
- unittest. Texttestrunner does not generate TXT test reports
- Apt command reports certificate error certificate verification failed: the certificate is not trusted
- Redis -- cache breakdown, penetration, avalanche
- 默认google浏览器打不开链接(点击超链接没有反应)
猜你喜欢
Win10桌面图标没有办法拖动(可以选中可以打开可以删除新建等操作但是不能拖动)
Latex warning: citation "*****" on page y undefined on input line*
Linux MySQL 5.6.51 community generic installation tutorial
How to debug wechat built-in browser applications (enterprise number, official account, subscription number)
pytest(1) 用例收集规则
由于不正常断电导致的unexpected inconsistency;RUN fsck MANUALLY问题已解决
Présence d'une panne de courant anormale; Problème de gestion de la fsck d'exécution résolu
sqli-labs通关汇总-page3
FE - 微信小程序 - 蓝牙 BLE 开发调研与使用
unittest.TextTestRunner不生成txt测试报告
随机推荐
uniapp引入本地字体
【文献阅读与想法笔记13】 Unprocessing Images for Learned Raw Denoising
工具种草福利帖
Queue (linear structure)
Storage space modifier in CUDA
Linux MySQL 5.6.51 Community Generic 安装教程
Latex参考文献引用失败 报错 LaTeX Warning: Citation “*****” on page y undefined on input line *
Apt command reports certificate error certificate verification failed: the certificate is not trusted
Kali latest update Guide
QQ email cannot receive the email sent by Jenkins using email extension after construction (timestamp or auth...)
js创建一个自定义json数组
Unexpected inconsistency caused by abnormal power failure; Run fsck manually problem resolved
flex九宫格布局
[daily question] - Huawei machine test 01
Redis -- cache breakdown, penetration, avalanche
The win10 network icon disappears, and the network icon turns gray. Open the network and set the flash back to solve the problem
Improve user experience defensive programming
微信小程序基础
Implement strstr() II
virtualenv和pipenv安装