DEV Community

Discussion on: Something is missing?

Collapse
 
okyanusoz profile image
okyanusoz • Edited

Use parseInt() to parse the integers.

Fixed code:

// Write your program here, create suitable objects and put them in the args variable, so that the following code can work normally

let result;
if(args.op=="+"){
   result=parseInt(args.n1)+parseInt(args.n2);
}else if(args.op=="-"){
   result=parseInt(args.n1)-parseInt(args.n2);
}else{
      result="Not supported";
}
console.log(result);
Enter fullscreen mode Exit fullscreen mode