js中Math()函数&&数据类型转换

Math()函数:

  1. x的y次方:Math.pow(x,y)
  2. 取小数点后两位:num.toFixed(2)

数据类型转换:

  1. 字符串转换为数字:parseInt(num)转换为整数;parseFloat(num)转换为浮点数;

     

posted @ 2016-03-02 11:05  白洋花海  阅读(473)  评论(0编辑  收藏  举报