1
0
Bernadette Elena Hammerle 3 жил өмнө
parent
commit
7b6b33ded5
2 өөрчлөгдсөн 10 нэмэгдсэн , 2 устгасан
  1. 5 1
      src/Addition.js
  2. 5 1
      src/Subtraction.js

+ 5 - 1
src/Addition.js

@@ -455,7 +455,11 @@ function Addition() {
 
     // if no commas in numbers
     if(commaPositions.length === 1 && commaPositions[0] !== numbersLen){
-      setCommaIdx(commaPositions[0] + 1);
+      if(commaPositions[0] < 0){
+         setCommaIdx(commaPositions[0]);
+      }else{
+        setCommaIdx(commaPositions[0] + 1);
+      }
       commaCorrect = true;
     }
 

+ 5 - 1
src/Subtraction.js

@@ -508,7 +508,11 @@ function Subtraction() {
 
     // if no commas in numbers
     if(commaPositions.length === 1 && commaPositions[0] !== numbersLen){
-      setCommaIdx(commaPositions[0] + 1);
+      if(commaPositions[0] < 0){
+         setCommaIdx(commaPositions[0]);
+      }else{
+        setCommaIdx(commaPositions[0] + 1);
+      }
       commaCorrect = true;
     }