Default Values | Table O Contents

How to convert Celsius temperature readings to Fahrenheit readings using Default Values …

Note. The Flammarion Logo Badge in the page header above is an .svg image file set to the dimensions of 5% width, auto height, and zoom. Go ahead and test the zoom-out feature by hovering over the badge to engage the expansion of the image.

Change Temp

Hint. First, create a standard function named convert temperature …

function convertTemperature(celsius, decimalPlaces = 1) {

  // decimalPlaces = decimalPlaces || 1;
  
  // if (!decimalPlaces) {
    // decimalPlaces = 1;
  // }
  
  const fahrenheit = celsius * 1.8 + 32;

  return Number(fahrenheit.toFixed(decimalPlaces));
}
// Call the function, override the default value
console.log(convertTemperature(21, 0));

Last Subtitle

More to come …

Note. The above synopsis was derived from a video lecture written, produced and performed by …

Reed Barger: [1].

For additional reference on the topic of Default Values see the Mozilla Developer Network: [2]

For a working Internet development platform for Javascript Functions see Scrimba: [3]

  1. Javascript: The Complete Developer, 2020

  2. Mozilla Developer Network

  3. Scrimba Javascript Developer Platform


Support

Please support the co-workers who aggregate the Source Links for our projects.

Patreon

Like what you see in this project? If so, then support the authors and machine-elves who aggregate the source links and pages for our projects via Patreon.