当前位置:网站首页>牛客JS2 文件扩展名
牛客JS2 文件扩展名
2022-07-02 14:51:00 【淹死的鱼u】
题目描述
请补全JavaScript代码,要求以字符串的形式返回文件名扩展名,文件名参数为"filename"。
题解:split(‘,’)分割字符串,返回分割的字符串数组。reverse()倒置数组,拼上 ‘.’ 返回。
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script> const _getExFilename = (filename) => {
// 补全代码 let arr = filename.split('.') arr.reverse() return '.' + arr[0] } </script>
</body>
</html>
边栏推荐
- What is agile development process
- What if the default browser cannot be set?
- 智能垃圾桶(五)——点亮OLED
- traceroute命令讲解
- PCL知识点——体素化网格方法对点云进行下采样
- Qwebengineview crash and alternatives
- Fuyuan medicine is listed on the Shanghai Stock Exchange: the market value is 10.5 billion, and Hu Baifan is worth more than 4billion
- Timing / counter of 32 and 51 single chip microcomputer
- 宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
- executescalar mysql_ExecuteScalar()
猜你喜欢
【Leetcode】13. Roman numeral to integer
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
綠竹生物沖刺港股:年期內虧損超5億 泰格醫藥與北京亦莊是股東
伟立控股港交所上市:市值5亿港元 为湖北贡献一个IPO
What if the default browser cannot be set?
TCP拥塞控制详解 | 2. 背景
默认浏览器设置不了怎么办?
Linux Installation PostgreSQL + Patroni cluster problem
Does digicert SSL certificate support Chinese domain name application?
Geoserver: publishing PostGIS data sources
随机推荐
简单线性规划问题
executescalar mysql_ ExecuteScalar()
IP address translation address segment
Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei
Exploration of mobile application performance tools
Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
一文看懂:数据指标体系的4大类型
The poor family once again gave birth to a noble son: Jiangxi poor county got the provincial number one, what did you do right?
云通信接口更新迭代——SUBMAIL API V4正式上线
Tech talk activity preview | building intelligent visual products based on Amazon kVs
dstat使用[通俗易懂]
Interpretation of key parameters in MOSFET device manual
The beginning of life
A case study of college entrance examination prediction based on multivariate time series
What is the difference between JSP and servlet?
The macrogenome microbiome knowledge you want is all here (2022.7)
详细介绍scrollIntoView()方法属性
Flutter: 动作反馈
Vscode setting delete line shortcut [easy to understand]
深度之眼(三)——矩阵的行列式