ByteNote LogoByteNote

Navigation

  • Blog
  • 工具

    © 2025 ByteNote. All rights reserved.

    JavaScript 取整的几种方法

    Apr 27, 20229 min read
    • Math.floor() 向下取整

      Math.floor(3.141592654) // 3
      
    • Math.ceil() 向上取整

      Math.ceil(3.141592654) // 4
      
    • Math.round() 四舍五入

      Math.round(3.141592654) // 3
      
    • parseInt() 去掉小数点和小数点后的部分

      parseInt(3.141592654) // 3
      
    • ~~ 将数据转化为Number类型

      ~~3.141592654 // 3
      

    相关文章

    fetch mode no-cors 的使用详解

    Fetch函数是ES6新增的网络请求API,通过提供"mode"选项(如"same-origin"和"no-cors")来控制请求模式,其中"no-cors"模式适用于不关心具体返回数据、只验证请求成功的跨域请求。

    一百个常用英文网络用语总结

    这份列表包含了100个常用的网络缩写和短语,用于快速沟通和表达各种情感、状态和需求。

    puppeteer TypeError text is not iterable

    Puppeteer 抛出 TypeError: text is not iterable 错误,可能是因为尝试将非字符串类型数据输入到文本类型的输入框中。

    使用Golang 实现一个无锁队列

    这是一个使用Golang实现的无锁队列示例,通过原子操作确保在并发环境下的高效读写,并支持单线程安全操作。

    sysctls 参数可以在 docker-compose.yml 中被用于定义系统内核参数

    sysctls 参数在 docker-compose.yml 中用于定义系统内核参数,如 `net.ipv4.ip_forward` 和 `net.core.somaxconn`。