当前位置:网站首页>牛客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>
边栏推荐
- Eye of depth (II) -- matrix and its basic operations
- Sword finger offer 26 Substructure of tree
- 默认浏览器设置不了怎么办?
- Understand one article: four types of data index system
- 剑指 Offer 25. 合并两个排序的链表
- R and rstudio download and installation tutorial (super detailed)
- Easy language ABCD sort
- Connect Porsche and 3PL EDI cases
- 宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
- Learning Weekly - total issue 60 - 25th week of 2022
猜你喜欢

剑指 Offer 25. 合并两个排序的链表

几行代码搞定RPC服务注册和发现

Eth data set download and related problems

Ap和F107数据来源及处理

线性规划例题 投资的收益与风险

Smart trash can (V) - light up OLED

Weili holdings listed on the Hong Kong Stock Exchange: with a market value of HK $500million, it contributed an IPO to Hubei

TCP congestion control details | 2 background

Amazon cloud technology community builder application window opens

TCP拥塞控制详解 | 2. 背景
随机推荐
【Leetcode】13. 罗马数字转整数
13、Darknet YOLO3
ROS知识点——ros::NodeHandle n 和 nh(“~“)的区别
IP address translation address segment
Timing / counter of 32 and 51 single chip microcomputer
酒仙网IPO被终止:曾拟募资10亿 红杉与东方富海是股东
The beginning of life
Eye of depth (III) -- determinant of matrix
2020 "Lenovo Cup" National College programming online Invitational Competition and the third Shanghai University of technology programming competition (a sign in, B sign in, C sign in, D thinking +mst
Sword finger offer 24 Reverse linked list
如何与博格华纳BorgWarner通过EDI传输业务数据?
Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
Learning Weekly - total issue 60 - 25th week of 2022
Cell: Tsinghua Chenggong group revealed an odor of skin flora. Volatiles promote flavivirus to infect the host and attract mosquitoes
Amazon cloud technology community builder application window opens
Interpretation of key parameters in MOSFET device manual
【Leetcode】13. Roman numeral to integer
IP地址转换地址段
TCP拥塞控制详解 | 2. 背景
JS delete substring in string