birthdayCakeCandles

    0

    0

    This code creates a function that will create a set of candles that is the same size as the number of arguments passed in.

    function birthdayCakeCandles(candles) {
      var max_candles = Math.max(...candles) 
      var number_candles = 0
      for(var i=0; i<candles.length; i++){
          if(candles[i] == max_candles){
              number_candles = number_candles + 1   
          }
      }
      
      return number_candles;
    }
    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.