JavaScript Challenge-9

 /*

Create a function that takes two arguments: the original price and the discount percentage as integers and returns the final price after the discount.

*/



let original_price;
let discount;
let result;

function discountedPrice(price, disc){
     if(disc<100){
        result = ((price)*((100 - disc)))/100;
     }else{
        result = "Please Enter valid value";
     }
     console.log(result);
}
discountedPrice(2000, 25);

Comments

Popular posts from this blog

Average of All Indexes of Array

JavaScript Coding Challenge-8

Largest and Lowest Number of the Array using JavaScript