Skip to content
On this page

array 数组

sum 数组求和

source

ts
import { sum } from 'fe-toolsbox'
const array = [1, 2, 3, 4, 5]
sum(array)
15

average 数组求平均数

source

ts
import { average } from 'fe-toolsbox'
const array = [1, 2, 3, 4, 5]
average(array)
3

uniq 数组去重

source

ts
import { uniq } from 'fe-toolsbox'
const array = [1, 2, 2, 3, 3, 4, 5]
uniq(array)
[ 1, 2, 3, 4, 5 ]

fe-toolsbox 前端业务常用工具库