Answers for "Day 17: More Exceptions hackerrank solution in javascript"

0

Day 17: More Exceptions hackerrank solution in javascript

// Day 17: More Exceptions hackerrank solution in javascript
//Write your code here
class Calculator {
    
    power(n,p){
        try{
           if((n>=0) && (p>=0)){
               return Math.pow(n,p);
           }else{
               error;
           }
            
        }
        catch(error){
            return "n and p should be non-negative";
        } 
    }
}
Posted by: Guest on December-31-2021

Code answers related to "Day 17: More Exceptions hackerrank solution in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language