📅  最后修改于: 2022-03-11 15:02:21.046000             🧑  作者: Mango
// 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";
}
}
}