angryProfessor.js

    0

    0

    The code defines a function called "angryProfessor" that takes two arguments, "k" and "a". The function accepts a numeric value, called "k", and a boolean value, called "a". The "angryProfessor" function will only execute if the boolean value "a" is equal to or greater than 1. If "a" is equal to or less than 1, the function will return a string value, "NO". If "a" is not equal to or less than 1, the function will return a string value, "YES".

    function angryProfessor(k, a) {
      
      let onTime = a.filter(function(value){
        return value < 1;
      });
      if (onTime.length >= k){
        return "NO";
      }else{
        return "YES";
      }
    }
    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.