We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
HI, everone its 16 day problem , i write this code but it gives errror of calculator is not defined. i didnot understand how to handle this. plz help me
class calculator {
//Write your code here
power(n,p){
try {
if(n>=0&&p>=0){
let power1=Math.power(n,p);
console.log(power1);}
else{
throw new Error('n and p should be non-negative');
Day 17: More Exceptions
You are viewing a single comment's thread. Return to all comments →
HI, everone its 16 day problem , i write this code but it gives errror of calculator is not defined. i didnot understand how to handle this. plz help me
class calculator { //Write your code here power(n,p){
try { if(n>=0&&p>=0){ let power1=Math.power(n,p);
console.log(power1);} else{ throw new Error('n and p should be non-negative');
} } catch(error) { console.log(error); } }
}https://)https://)https://)https://)https://)