摘要:        
[...XXX] 对set的使用 const removeDuplicates = (arr) => [...new Set(arr)]; console.log(removeDuplicates([1, 2, 3, 3, 4, 4, 5, 5, 6])); // Result: [ 1, 2, 3    阅读全文
posted @ 2021-11-01 10:09
Dz&Ying
阅读(583)
评论(0)
推荐(0)
        
            
        
        
摘要:        
传递 window.location 或原始 URL值 goole.com?search=easy&page=3 从 url 轻松检索查询参数 const getParameters = (URL) => { URL = JSON.parse('{"' + decodeURI(URL.split("    阅读全文
posted @ 2021-11-01 10:00
Dz&Ying
阅读(65)
评论(0)
推荐(0)
        
            
        
        
摘要:        
使用getSelectionproperty const getSelectedText = () => window.getSelection().toString(); getSelectedText();    阅读全文
posted @ 2021-11-01 09:58
Dz&Ying
阅读(218)
评论(0)
推荐(0)
        
            
        
        
摘要:        
检查数组是否为空,返回 true 或 false。 const isNotEmpty = arr => Array.isArray(arr) && arr.length > 0; isNotEmpty([1, 2, 3]); // Result: true    阅读全文
posted @ 2021-11-01 09:56
Dz&Ying
阅读(73)
评论(0)
推荐(0)
        
            
        
        
摘要:        
const isDateValid = (...val) => !Number.isNaN(new Date(...val).valueOf()); isDateValid('2021-10-10') isDateValid('Mon Nov 01 2021 09:49:48 GMT+0800 (中    阅读全文
posted @ 2021-11-01 09:54
Dz&Ying
阅读(36)
评论(0)
推荐(0)
        
                    
                
浙公网安备 33010602011771号