摘要: 给你一个只包含 '(' 和 ')' 的字符串,找出最长有效(格式正确且连续)括号子串的长度。 栈的方式 const longestValidParentheses = (s) => { let max = 0; const stack = [-1]; for (let i = 0; i < s.le 阅读全文
posted @ 2024-03-13 21:56 671_MrSix 阅读(1) 评论(0) 推荐(0) 编辑
摘要: const useUserNetworkMonitor = () => { const info = { startTime: 0, duration: 5000, }; let timer = null; const loop = (url, interval = 5 * 1000) => { t 阅读全文
posted @ 2024-03-11 21:07 671_MrSix 阅读(1) 评论(0) 推荐(0) 编辑
摘要: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36 UA 字符串各部分的含义如下: Mozilla/5.0:表示当前浏览器所使用 阅读全文
posted @ 2024-03-07 21:53 671_MrSix 阅读(11) 评论(0) 推荐(0) 编辑
摘要: const isValidBinarySearchTree = (tree) => { const stack = [Number.MIN_VALUE]; const loop = (node) => { if (node null) return; loop(node.left); if (sta 阅读全文
posted @ 2024-03-07 20:52 671_MrSix 阅读(1) 评论(0) 推荐(0) 编辑
摘要: export const convertRes2Blob = (response, name) => { // 提取文件名 const match = response.headers['content-disposition']?.match(/filename=(\S*)$/) || [] co 阅读全文
posted @ 2024-02-27 20:09 671_MrSix 阅读(1) 评论(0) 推荐(0) 编辑
摘要: export const requestFullScreen = ele => { if (ele.requestFullscreen) { ele.requestFullscreen() } else if (ele.webkitRequestFullScreen) { ele.webkitReq 阅读全文
posted @ 2024-01-29 17:21 671_MrSix 阅读(4) 评论(0) 推荐(0) 编辑
摘要: const getStandardRatio = (width, height, widthRatio = 16, heightRatio = 9) => { // 实际宽高比 const computedRatio = width / height; // 标准宽高比 const standard 阅读全文
posted @ 2023-12-24 00:29 671_MrSix 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 一、M3U8简介 M3U8文件是指UTF-8编码格式的M3U文件(M3U使用Latin-1字符集编码)。M3U文件是一个记录索引的纯文本文件,打开它时播放软件并不是播放它,而是根据它的索引找到对应的音视频文件的网络地址进行在线播放。其流程如下: M3U8文件是指UTF-8编码格式的M3U文件。M3U 阅读全文
posted @ 2023-12-14 23:04 671_MrSix 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 当前工程化的痛点 在浏览器支持ES Module之前,JavaScript并没有提供原生机制让开发者以模块化的方式进行开发。这也是打包工具诞生的原因:使用工具抓取,处理并将源码模块串联成可以在浏览器中运行的文件。 虽然现在有webpack,Rollup等工具,极大地改善了前端开发者的体验。但是当构建 阅读全文
posted @ 2023-12-13 22:02 671_MrSix 阅读(24) 评论(0) 推荐(1) 编辑
摘要: // 华氏度转摄氏度 const toCelsius = (fahrenheit) => { return (fahrenheit - 32) * 5 / 9; } // 摄氏度转华氏度 const toFahrenheit = (celsius) => { return (celsius * 9 阅读全文
posted @ 2023-03-08 17:31 671_MrSix 阅读(198) 评论(0) 推荐(0) 编辑