当前位置:网站首页>牛客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>
边栏推荐
- 2、 Expansion of mock platform
- What is agile development process
- What will you do after digital IC Verification?
- class和getClass()的区别
- 2022 interview questions
- Timing / counter of 32 and 51 single chip microcomputer
- visibilitychange – 指定标签页可见时,刷新页面数据
- 深度之眼(三)——矩阵的行列式
- 海思Hi3798MV100机顶盒芯片介绍[通俗易懂]
- Experience home office, feel the completion of the project | community essay solicitation
猜你喜欢

871. 最低加油次数

如何与博格华纳BorgWarner通过EDI传输业务数据?

Sword finger offer 22 The penultimate node in the linked list

Configure ARP table entry restrictions and port security based on the interface (restrict users' private access to fool switches or illegal host access)

智能垃圾桶(五)——点亮OLED

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

Use the API port of the bridge of knowledge and action to provide resources for partners to access

剑指 Offer 27. 二叉树的镜像

Interpretation of key parameters in MOSFET device manual

Tech Talk 活动预告 | 基于Amazon KVS打造智能视觉产品
随机推荐
【征文活动】亲爱的开发者,RT-Thread社区喊你投稿啦
Nexus简介及小白使用IDEA打包上传到Nexus3私服详细教程
Role and function of uboot
The difference between class and getClass ()
ThreadLocal
Use of openpose
Timing / counter of 32 and 51 single chip microcomputer
Qstype implementation of self drawing interface project practice (II)
Sword finger offer 25 Merge two sorted linked lists
Leetcode question brushing record | 933_ Recent requests
What is agile development process
博客主题 “Text“ 夏日清新特别版
Eye of depth (II) -- matrix and its basic operations
Blog theme "text" summer fresh Special Edition
例题 非线性整数规划
如何与博格华纳BorgWarner通过EDI传输业务数据?
Meanings of SNAT, DNAT and masquerade in iptables
默认浏览器设置不了怎么办?
What is the difference between JSP and servlet?
Sword finger offer 24 Reverse linked list