Doubt Solving

Why my program is not working for all tests of this question ?
const sentence = readline();
var arr = new Array();
for(let i = 0;i<sentence.length;i++){
var c = sentence.charCodeAt(i);
if(c>=48 && c<=57){
var sum =0;
for(let j=0;j<arr.length;j++){

You are given a string sentence as input, you must find the different numbers contained in this variable and display their sum.
For instance, if sentence is “h3110 w0r1d !”, you can find “3110”, “0” and “1” in it. You have to print their sum: “3111”

Won’t this program, with the given example, read the four numbers 3,1,1,0 instead of the number 3110?

No, it won’t work