var 6117 var x2 10 var x3 Math floor 1000 var x4 Math floor 100 10 var

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
var x = 6117;
var x2 = x%10;
var x3 = Math.floor (x/1000);
var x4 = (Math.floor (x/100)) %10;
var x5 = Math.floor((x%100)/10);
if ((x2=x3) && (x3=x4)){
console.log ("YES");
} else {
console.log ("NO");
}