Declaring variable with 'let' keyword in the switch-case

Question | Dec 26, 2017 | hkumar 

enter image description here

We are writing a temperature conversion utility function that converts Fahrenheit to Celsius and vice versa. The function takes a temperature number and converts it to specified scale:

function convert(t, scale) {  

 switch(scale) {
  case 'C': // t is in Fahrenheit. Convert it to Celsius
   let ct = (t - 32)/1.8;
   return ct;
  default:  // Convert to Fahrenheit by default
   let ct = t*1.8 + 32;
   return ct;


What will be the result of calling convert as: