I need an application in JS to which I should compare 2 IPs.
The initial numbers should be equal but the end of the 1 IP should always be greater than the second one Example:
10.200.1.6 > 10.200.1.2 = true
My code:
var rangeInicio = '10.200.1.6';
var splits = rangeInicio.split('.', 4);
console.log(splits);
var rangeFim = '10.200.1.2';
var splits = rangeFim.split('.', 4);
console.log(splits);
function myFunction() {
var rangeInicio = "10.200.1.6";
var rangefim = "10.200.1.2";
var n = rangeInicio.localeCompare(rangeFim);
document.getElementById("demo").innerHTML = n;
}
$(document).ready(function("demo") {
$("#more").click(function ("demo") {