×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Nilesh Yadav
Added: Aug 10, 2017 11:31 AM
Views: 5
Tags: no tags
  1. switch (expr) {
  2.   case 'Oranges':
  3.     console.log('Oranges are $0.59 a pound.');
  4.     break;
  5.   case 'Apples':
  6.     console.log('Apples are $0.32 a pound.');
  7.     break;
  8.   case 'Bananas':
  9.     console.log('Bananas are $0.48 a pound.');
  10.     break;
  11.   case 'Cherries':
  12.     console.log('Cherries are $3.00 a pound.');
  13.     break;
  14.   case 'Mangoes':
  15.   case 'Papayas':
  16.     console.log('Mangoes and papayas are $2.79 a pound.');
  17.     break;
  18.   default:
  19.     console.log('Sorry, we are out of ' + expr + '.');
  20. }
  21.  
  22. console.log("Is there anything else you'd like?");