var inp = document.getElementById('inp'); function digi(){ var n = inp.value; var digit = parseInt(n, 2); var modified = String(digit); var arra = digit.split(','); for(var i = 2; i < n; i++){ console.log(digit); for(var j = 0; j < arra.length; j++){ if(j == 1 ){ var opp = []; var arr = opp.push(j); } else if(j == 0){ var pop = []; var arr2 = pop.push(j); } if(arr.length > arr2.length){ console.log(n); } } } } digi(55); Hello, I can not understand why split does not work In the console it says that split is not a function I tried instead of writing the value in the variable n to write the number directly to the function parameter, did not help