Advertisement
Spocoman

10. Multiply by 2

Dec 22nd, 2021 (edited)
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function multiplyBy2(input) {
  2.     for (let i = 0; i < input.length; i++){
  3.         if (input[i] >= 0){
  4.             console.log(`Result: ${(input[i] * 2).toFixed(2)}`);
  5.         } else{
  6.             console.log('Negative number!');
  7.             break;
  8.         }
  9.     }
  10. }
  11.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement