Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function wrongResult(...nums) {
- recursiveSign(nums);
- function recursiveSign(nums, sign = 'Positive') {
- if (nums.length === 0 ) {
- console.log(sign);
- return;
- }
- let num = nums.pop();
- if (num === 0 ) {
- console.log('Positive');
- return;
- }
- if ((sign === 'Positive' && num > 0) || (sign === 'Negative' && num < 0)) {
- recursiveSign(nums, 'Positive');
- } else {
- recursiveSign(nums, 'Negative');
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement