当前位置:网站首页>JS-BOM-Name Converter - Input Name Position Reversed
JS-BOM-Name Converter - Input Name Position Reversed
2022-08-08 14:36:00 【(-^_^-)】
All string methods:
Use index of indexOf()
Extract string: substring()
Returns the character at the specified position: charAt()
function hanshu(){var n =document.getElementById('1');name=n.value; //The name is the content entered in the text boxvar spaceIndex=name.indexOf(" ");//Return the index position of the first spacevar firstName=name.substring(0,spaceIndex);//The first wordvar laterName=name.substring(spaceIndex+1);//Extract the word after removing the first spacespaceIndex=laterName.indexOf(" ");//Return the index position where the first space is removedvar SecondName=laterName.substring(0,spaceIndex);//The second wordvar lastName=laterName.substring(spaceIndex+1);n.value=lastName + " "+SecondName+ " "+firstName;}
边栏推荐
猜你喜欢
开源一夏 | 自己画一块ESP32-C3 的开发板(PCB到手)
HMS Core Analysis Service Intelligent Operation Version 6.5.1 Launched
QtWebassembly遇到的一些报错问题及解决方案
华为云云数据库RDS MySQL 版初试探【华为云至简致远】
优雅地实时检测和更新 Web 应用
更改默认打开应用程序设置
shell regular expression, Three Musketeers grep command
暗恋云匹配匿名交友聊天系统开发
「复盘」面试BAMT回来整理398道高频面试题,助你拿高薪offer
直播卖货APP——为何能得到商家和用户的喜欢?
随机推荐
路由器——交换机——网络交换机:区别
【LeetCode】761. Special binary sequence
logistic regression model - based on R
优雅地实时检测和更新 Web 应用
2022-08-07 第五小组 顾祥全 学习笔记 day31-集合-Map集合
零基础入门华为云数据库RDS【华为云至简致远】
Ingress:比Service更强大的服务暴露与负载均衡
Shell Three Musketeers-----sed command
如何成为团队核心?从写出不可维护的代码开始
flutter 身兼数职的getx —— 简介
兆骑科创创业赛事活动举办平台,投融资对接,线上直播路演
[Small Coder Study Room] [NOI Online 2020-2 Beginner Group] Finished: Abominable precision will make you burnt
【干货】交换机的接口类型完全实物了解
基于ModelArts的StyleGAN3生成高清图丨【华为云至简致远】
itk中生成drr整理
synchronized修饰类的注意事项
【控制】动力学建模举例 --> 拉格朗日法
非科班毕业生,五面阿里:四轮技术面+HR一面已拿offer
Tensorflow and Keras for machine learning, deep learning
Ubuntu下使用sudo dpkg --configure -a后数据库出现问题