“JavaScript entre” Código de respuesta

Número de JavaScript entre valores

Number.prototype.between = function(a, b) {
  var min = Math.min.apply(Math, [a, b]),
    max = Math.max.apply(Math, [a, b]);
  return this > min && this < max;
};

var windowSize = 550;

console.log(windowSize.between(500, 600));
Prafy

Si entre dos números JavaScript

if (500 < thenumber && thenumber < 600) {
  // ...
}
Confused Sphere

JavaScript entre

Number.prototype.between = function(a,b){ 
  return (a>b) ? this>=b && this<=a : this>=a && this<=b;
} 

(7).between(5,10); // true
(3).between(5,10); // false
Luis Alfredo G Caldas Neto

Respuestas similares a “JavaScript entre”

Preguntas similares a “JavaScript entre”

Más respuestas relacionadas con “JavaScript entre” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código