calcAverageRating(ratings) {
let totalWeight = 0;
let totalReviews = 0;
ratings.forEach((rating) => {
const weightMultipliedByNumber = rating.weight * rating.count;
totalWeight += weightMultipliedByNumber;
totalReviews += rating.count;
});
const averageRating = totalWeight / totalReviews;
return averageRating.toFixed(2);
}
const ratings = [
{
weight: 5,
count: 252
},
{
weight: 4,
count: 124
},
{
weight: 3,
count: 40
},
{
weight: 2,
count: 29
},
{
weight: 1,
count: 33
}
];
console.log(calcAverageRating(ratings));
我正在使用Windows 10 64位。我想做的是先运行a.exe。然后等待5秒钟并同时运行b和c。但它们都同时开始运行
答案 0 :(得分:1)
SLEEP
无法识别为内部或外部命令,可操作程序或批处理文件。尝试使用TIMEOUT /T 5 >NUL
。
答案 1 :(得分:0)
我推荐Powershell。
& "C:\Program Files (x86)\Notepad++\notepad++.exe"
Start-Sleep -Seconds 5
& "C:\Program Files\JetBrains\PyCharm Community Edition 2018.3.5\bin\pycharm.exe"
仅作为示例
希望有帮助! BR