【AE表达式案例】给数组的所有小数取整,不用For

【AE表达式案例】给数组的所有小数取整,不用For

今天在研究toComp时,发现一个很尴尬的问题,产生的数组小数点太多了,又懒得用for遍历。于是乎

使用方法

本函数需要使用AE2020

a=[796.2685416,941.16516,2776.77777];
Array.from(a, x => x.toFixed())
//亦或者
Array.from([796.2685416,941.16516,2776.77777], x => x.toFixed())

参考

[from()函数](https://www.yuelili.com/docs/expression_a-z/expression-f#from())、 [toFixed()函数](https://www.yuelili.com/docs/expression_a-z/expression-t#tofixed())

给TA充电
共{{data.count}}人
人已充电
AEAE表达式

[表达式]使用repeat创建动作

2020-7-22 1:12:50

AEAE文章AE表达式

【AE表达式】loop 循环详解

2020-8-1 14:10:06

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
今日签到
搜索