var products = [
    { name: "Kapelusz", price: 24.5, stock: 10 },
    { name: "Kajak", price: 289.99, stock: 1 },
    { name: "Piłka nożna", price: 10, stock: 0 },
    { name: "Buty do biegania", price: 116.50, stock: 20 }
];
var totalValue = products
    .filter(function (item) { return item.stock > 0; })
    .reduce(function (prev, item) { return prev + (item.price * item.stock); }, 0);
console.log("Razem: " + totalValue.toFixed(2) + " zł.");
