plusMInusTwo

    0

    0

    The code computes the sum of all the positive numbers, the sum of all the negative numbers, and the number 0 (zeros).

    function plusMinus(){
      let positive = arr.filter(number => number > 0).length / arr.length;
      let negative = arr.filter(number => number < 0).length / arr.length;;
      let zeronums = arr.filter(number => number == 0).length / arr.length;;
      return console.log(positive.toFixed(6) + '\n' + negative.toFixed(6) + '\n' + zeronums.toFixed(6))
    }
    Codiga Logo
    Codiga Hub
    • Rulesets
    • Playground
    • Snippets
    • Cookbooks
    soc-2 icon

    We are SOC-2 Compliance Certified

    G2 high performer medal

    Codiga – All rights reserved 2022.