Javascript switch statement Question 2

Introduction

What is the output of the following code?


function price(item)
{
    switch (item) {
                case "comic book":
                        return 3.41;
                        break;//from ww  w.j a va  2 s .c o m
                case "milk 2L":
                        return 4.59;
                        break;    
                case "apple":
                        return 0.39;
                        break;
                case "potato chips":
                        return 1.29;
                        break;
                default:
                        return 0;
                        break;
    }
}

console.log("$" + price("apple"));  


$0.39



PreviousNext

Related