50 lines
1.0 KiB
JavaScript

// regular function
// const calcArea = function (radius) {
// let area = 3.14 * radius ** 2;
// console.log("Area is :",area);
// return area;
// }
// arrow function
// const calcArea = (radius) => {
// let area = 3.14 * radius ** 2;
// console.log("Area is :", area);
// return area;
// }
// const calcArea = radius => {
// return area = 3.14 * radius ** 2;
// }
// das Gleiche
// const calcArea = radius => 3.14 * radius ** 2;
// const helloWorld = function(){
// return "Hello World"
// }
// das Gleiche
// const helloWorld = () => "Hello World";
// const result = helloWorld();
// console.log(result);
const bill = function (products, tax) {
let total = 0;
for (let i = 0; i < products.length; i++) {
total += products[i]
}
total *= (tax / 100);
return total;
}
const bill = (products, tax) => {
let total = 0;
for (let i = 0; i < products.length; i++) {
total += products[i]
}
return total *= (tax / 100);
};