# problems **Repository Path**: Weibozzz/problems ## Basic Information - **Project Name**: problems - **Description**: No description available - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2018-05-25 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README ``` let person={ // 这是一个人,他有三种货币(a1,a2,a3),分别放在三个钱包(wallet)里面,并且有不同的数量(amount), a1:[ { wallet:'s1', amount:1000 }, { wallet:'s2', amount:1300 }, ], a2:[ { wallet:'s3', amount:1400 }, ], a3:[ { wallet:'s1', amount:1000 }, { wallet:'s3', amount:1350 }, ], } let rate={ // 这是汇率,比如a1货币amount为1000,那么他就值1000*20, // a2货币amount为1000,那么他就值1000*23, // a3货币amount为1000,那么他就值1000*34 a1:20, a2:23, a3:34 } /* * 写一个函数,实现result数组 * */ let result = [ //这是最后想要得到的结果,每个钱包有多少钱,占了这个人总共的钱数的百分比 { wallet:'s1',//s1钱包 price:(1000+1000)*20,// person的所有a1货币,乘以rate对应的 percent:(1000+1000)*20/(((1000+1000)*20)+1300*34+(1400+1350)*23) // s1钱包的钱除以这个人总共的钱 }, { wallet:'s2', price:3000, percent:0.2 }, { wallet:'s3', price:3000, percent:0.2 } ] ```