当前位置:网站首页>牛客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>
边栏推荐
- ROS知识点——ros::NodeHandle n 和 nh(“~“)的区别
- 相信自己,这次一把搞定JVM面试
- AP and F107 data sources and processing
- [fluent] dart data type map type (create map set | initialize map set | traverse map set)
- 871. 最低加油次数
- 一文看懂:数据指标体系的4大类型
- Connect Porsche and 3PL EDI cases
- Explanation of traceroute command
- 【Leetcode】14. Longest Common Prefix
- TCP congestion control details | 2 background
猜你喜欢
Believe in yourself and finish the JVM interview this time
Tech Talk 活动预告 | 基于Amazon KVS打造智能视觉产品
Changwan group rushed to Hong Kong stocks: the annual revenue was 289million, and Liu Hui had 53.46% voting rights
Eth data set download and related problems
ETH数据集下载及相关问题
对接保时捷及3PL EDI案例
[shutter] dart data type (dynamic data type)
剑指 Offer 22. 链表中倒数第k个节点
QWebEngineView崩溃及替代方案
社交元宇宙平台Soul冲刺港股:年营收12.8亿 腾讯是股东
随机推荐
详细介绍scrollIntoView()方法属性
求简单微分方程
几行代码搞定RPC服务注册和发现
Timing / counter of 32 and 51 single chip microcomputer
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
剑指 Offer 27. 二叉树的镜像
traceroute命令讲解
LSF basic command
宝宝巴士创业板IPO被终止:曾拟募资18亿 唐光宇控制47%股权
Exploration of mobile application performance tools
Briefly introduce the use of base64encoder
书包网小说多线程爬虫[通俗易懂]
Sword finger offer 22 The penultimate node in the linked list
Nexus簡介及小白使用IDEA打包上傳到Nexus3私服詳細教程
Linux Installation PostgreSQL + Patroni cluster problem
Green bamboo biological sprint Hong Kong stocks: loss of more than 500million during the year, tiger medicine and Beijing Yizhuang are shareholders
Visibilitychange – refresh the page data when the specified tab is visible
【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
Vscode setting delete line shortcut [easy to understand]
深度之眼(二)——矩阵及其基本运算