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