Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

223
Vistas
Is there a shorter, smarter way to deal with a long list of conditions in an if statement?

For example: I have a grid where each square is identified by a value denoting row and column, eg: 32 is in the 3rd column and 2nd row. Nearby locations would be squares 31, 33, 41, 42, 43, 21, 22, 23.

if (main.location === player.location - 1 || 
main.location === player.location + 1 || 
main.location === player.location - 9 || 
main.location === player.location + 9 || 
main.location === player.location - 10 || 
main.location === player.location + 10 || 
main.location === player.location - 11 || 
main.location === player.location + 11) {
    console.log("player is nearby");
    }
about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda