I need to check if has a 2 numbers sequence, if has comes back true, if not false.
example:
113489 //false on 11
123456 // true
189033 // false on 33
Can be with regex or without regex.
>Solution :
I don’t know how to do it with regex, so why not just loop over it
var str = "189033";
function check(str) {
var arr = str.split("");
var last = null;
for (var i = 0; i < arr.length; i++) {
var digit = arr[i]
if (digit == last) {
return false;
}
last = digit;
}
return true;
}
console.log(check(str))
console.log(check("123456"))