Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function multiplyBy2(input) {
- let num = 0;
- for (i = 0; i < input.length; i++) {
- num = Number(input[i]);
- num *= 2;
- if (Math.sign(num) === 1) {
- console.log("Result: " + num.toFixed(2));
- i++;
- } else {
- console.log("Negative number!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment