JavaScript內建函式


Posted by oack7426 on 2020-06-30

tips:
此處筆記寫得很簡略,詳細請看官網的常用函式介紹

數字相關

Number({內容})
parseInt({內容},{幾進位}) 整數(預設10進位)
parseFloat({內容}) 浮點數

{變數} +'' 數字變字串

參考資料

Number

數字運算

Math
Math.cell({內容}) 無條件進位
Math.floor({內容}) 無條件捨去
Math.round({內容}) 四捨五入
Math.random() 產生 0 ~ 0.99999 的亂數

參考資料

Math

String

字串也能比大小 (a-z / A-Z)
indexOf({內容})找字串
split()切字串

參考資料

String

Array

join()
map
filter() 過濾
slice

參考資料

Array


#javascrit







Related Posts

C# The way to store a temporary data: Memory Cache, Redis

C# The way to store a temporary data: Memory Cache, Redis

DataTables 試作X捲軸

DataTables 試作X捲軸

Nuxt(3) - store & 生命週期

Nuxt(3) - store & 生命週期


Comments