24 lines
788 B
JavaScript
24 lines
788 B
JavaScript
// 測試權重顯示格式
|
|
const testWeights = [25.00, 20.00, 20.00, 15.00, 20.00];
|
|
|
|
console.log('🔄 測試權重顯示格式...');
|
|
|
|
// 計算總權重
|
|
const totalWeight = testWeights.reduce((sum, weight) => sum + weight, 0);
|
|
|
|
console.log('個別權重:');
|
|
testWeights.forEach((weight, index) => {
|
|
console.log(` ${index + 1}. ${weight.toFixed(1)}%`);
|
|
});
|
|
|
|
console.log(`\n總權重: ${totalWeight.toFixed(1)}%`);
|
|
console.log(`是否等於 100%: ${totalWeight === 100 ? '✅' : '❌'}`);
|
|
|
|
// 測試權重顯示的各種格式
|
|
console.log('\n權重顯示格式測試:');
|
|
console.log(`原始格式: ${totalWeight}%`);
|
|
console.log(`toFixed(1): ${totalWeight.toFixed(1)}%`);
|
|
console.log(`toFixed(0): ${totalWeight.toFixed(0)}%`);
|
|
|
|
console.log('\n🎉 權重顯示格式測試完成!');
|