首页笔记趣玩其他
章节
    AllStringArrayObjectRegExpDate
    String
    大数值问题
    数字只能处理 16 位数字,字符串转换加减法等都是。js 安全整数范围是 -2^53 + 1 - 2^53 - 1(-9,007,199,254,740,991 到 9,007,199,254,740
    lhh|07/31/2024 12:22
    String
    颜色处理(十六进制,GRG)
    生成随机十六进制const randomHex = () => `#${Math.floor(Math.random() * 0xffffff) .toString(16) .pa
    lhh|07/31/2024 12:22
    String
    ASCII 码处理
    // A:65 Z:90 a:97 z:122 const s = "AZaz"; // 获取字符A的ascii码 s.charCodeAt(0); // 65 // ascii吗转字符串 Strin
    lhh|07/31/2024 12:21
    String
    金额每三位一个逗号,并保留小数点
    // 方法一 const priceFormat = (num) => num.toLocaleString(); // toLocaleString 将数字转化为每隔三位一个逗号,如果是浮点数,则四
    lhh|07/31/2024 12:20
    String
    字符串以第一个括号和最后一个括号分隔字符串
    // https://cloud.tencent.com/developer/ask/sof/1858882 let str = "abcd(123(444(555))--(666))"; str.s
    lhh|07/31/2024 12:20
    String
    获取地址参数
    const url = 'www.baidu.com/search?key=haha&id=123' // 方法一 const getParameters = URL => JSON.parse(`{
    lhh|07/31/2024 12:16
    String
    科学计数法
    String(0.0000005); // '5e-7' (5*10^-7)的意思 Number("5e+5"); // 500000
    lhh|07/31/2024 12:16
    String
    判断奇偶数
    const OddEven = (num) => (!!(num & 1) ? "odd" : "even"); OddEven(2); // even OddEven(7); // odd
    lhh|07/31/2024 12:15
    String
    数字取整
    let num = 3.14; parseInt(num); // 3 向下取整 Math.round(num); // 3 四舍五入 Math.floor(num); // 3 向下取整 Math.
    lhh|07/31/2024 12:15
    String
    运算符
    // 幂运算符 ** 2 ** 4 === Math.pow(2, 4); // true (16) // 非运算符 ~ ~~"123"; // 123 取两次非 // 空值合并操作符 ?? (n
    lhh|07/31/2024 12:15
    JavaScriptTypeScriptReactNpmGitCss小程序面试题