About 295,000 results
Open links in new tab
  1. javascript - Calculate percentage using switch case - Stack Overflow

    Feb 4, 2018 · let vraag = prompt("Omzet:"); let cijfer = Number.parseInt(vraag); let discount = 0; switch (true) { case cijfer >= 100: discount = 0.1; //10% break; case cijfer >= 500: discount = …

  2. How to Calculate Discount in Javascript - Students Tutorial

    <input id="discount">% <br><br> <button onclick="getPrice()"> <br><br> <input readonly id="total"> <script> getPrice = function() { var numVal1 = …

  3. JavaScript switch case Statement - JavaScript Tutorial

    This tutorial shows you how to use the JavaScript switch case statement to evaluate a block based on multiple conditions.

  4. switch - JavaScript | MDN - MDN Web Docs

    Mar 13, 2025 · The switch statement evaluates an expression, matching the expression's value against a series of case clauses, and executes statements after the first case clause with a …

  5. JavaScript Switch Statement - W3Schools

    Use the switch statement to select one of many code blocks to be executed. This is how it works: The switch expression is evaluated once. The value of the expression is compared with the …

  6. JavaScript switch...case Statement (with Examples) - Programiz

    The JavaScript switch statement executes different blocks of code based on the value of a given expression. In this tutorial, you will learn about the JavaScript switch statement with the help of …

  7. Switch Statement in JavaScript: Implementation with Examples

    Jan 26, 2025 · In this JavaScript tutorial, we'll explore all the facets of Switch Statements in JavaScript, including syntax, examples, flowchart of switch statement, nested switch case, …

  8. javascript - applying 10% discount in calculation - Stack Overflow

    Jul 19, 2022 · Given a price and a discount percentage, you will get the discounted price. function applyDiscount(price, discountPercent) { return price - (price / discountPercent); } const price = …

  9. JavaScript Switch Statement – The Ultimate Guide with In-Depth …

    Apr 22, 2024 · In this comprehensive guide, we‘ll dive deep into the world of switch statements, exploring their syntax, use cases, best practices, and advanced techniques. Let‘s start by …

  10. JavaScript program to calculate discount - Posts - OneCompiler

    Jun 29, 2018 · Following program shows you how to calculate discount. var discount = parseInt (prompt("Enter discount percentage:")); var afterDiscount = bill - (bill * discount / 100); …

Refresh