摘要: function deepCopy2<T extends object>(object: T) { return new Promise<T>((resolve) => { const {port1, port2} = new MessageChannel(); port1.postMessage( 阅读全文
posted @ 2024-12-02 14:26 技术探索者 阅读(31) 评论(0) 推荐(0)
摘要: function copyText(txt: string) { return new Promise((resolve, reject) => { const domCopy = function () { const input = document.createElement('input') 阅读全文
posted @ 2024-12-02 14:24 技术探索者 阅读(86) 评论(0) 推荐(0)
摘要: function formatPrice(val: string | number, precision: number = 2) { if (typeof val 'string') { let num = parseFloat(val) if (isNaN(num) || num.toStrin 阅读全文
posted @ 2024-12-02 14:23 技术探索者 阅读(44) 评论(0) 推荐(0)
摘要: 第一步,写一个html页面 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>飞机大战</title> <style> body { margin: 0; } canvas { display: block; 阅读全文
posted @ 2024-11-26 17:17 技术探索者 阅读(231) 评论(0) 推荐(0)
摘要: 以下是JS方法获取100以内的质数 function getPrimes(max) { const primes = []; for (let num = 2; num <= max; num++) { let isPrime = true; for (let div = 2; div * div 阅读全文
posted @ 2024-07-26 10:35 技术探索者 阅读(39) 评论(0) 推荐(0)