Math常用属性

<template>
  <div>
    Math常用属性
  </div>
</template>

<script>
export default {
    
    
  data() {
    
    
    return {
    
    

    }
  },
  created() {
    
    
    let a = Math.round(0.9) // 四舍五入 1
    let b = Math.ceil(0.8) // 向上取整 1
    let c = Math.floor(0.8) // 向下取整 0
    let d = Math.abs(9) // 求绝对值 9
    let e = Math.max(2,-5,10) // 求最大值 10
    let f = Math.min(2,-5,10) // 求最小值 -5
    let g = Math.random() // 大于0 小于 1的随机数
  },
}
</script>

猜你喜欢

转载自blog.csdn.net/qq_52099965/article/details/127990203