let hatPrice = 100;
console.log(`Cena czapki: ${hatPrice}`);
let bootsPrice = "100";
console.log(`Cena butów: ${bootsPrice}`);
let sumPrices = (...numbers) => numbers.reduce((total, val) =>
total + (Number.isNaN(Number(val)) ? 0 : Number(val)));
let totalPrice = sumPrices(hatPrice, bootsPrice); console.log(`Wartość całkowita: ${totalPrice} ${typeof totalPrice}`);
totalPrice = sumPrices(100, 200, 300);
console.log(`Wartość całkowita: ${totalPrice} ${typeof totalPrice}`);
totalPrice = sumPrices(100, 200, undefined, false, "Witaj"); console.log(`Wartość całkowita: ${totalPrice} ${typeof totalPrice}`);
Witam. Uczę się js'a i jest kod let sumPrices = (...numbers) => numbers.reduce((total, val) =>
total + (Number.isNaN(Number(val)) ? 0 : Number(val))); I za cholerę nie wiem co on robi a nie jest to w ogóle wytłumaczone jakkolwiek także prosiłbym o wytłumaczenie :)