Advertisement
dimipan80

Powerful Cars

Nov 8th, 2014
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /* Write a JavaScript function convertKWtoHP(number) that accepts number variable
  2. to convert car’s kW into hp (horse power). Write a JS program powerfulCars.js that converts
  3. a few sample values to hp (see the examples below). The result should be printed on the console,
  4. rounded up to the second sign after the decimal point. */
  5.  
  6. "use strict";
  7.  
  8. function convertKWtoHP(number) {
  9.     return number / 0.745699872;
  10. }
  11.  
  12. console.log(convertKWtoHP(75).toFixed(2));
  13. console.log(convertKWtoHP(150).toFixed(2));
  14. console.log(convertKWtoHP(1000).toFixed(2));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement