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

97
Vistas
Deconstruct Object into Array of custom variable names

The idea, not a valid code, inspired by this answer:

const source1 = {x1: -5, y1: -5, x2: 10, y2: 10};
const source2 = {x1: 15, y1: 15, x2: 20, y2: 20};

// the ['s1x1'] expression becomes the variable name and x1 as its value
const [['s1x1']: x1, ['s1y1']: y1, ['s1x1']: x2, ['s1x1']: y2] = source1;
const [['s2x1']: x1, ['s2y1']: y1, ['s2x2']: x2, ['s2y2']: y2] = source2;

// use the new variables
let result = s1x1 * s2x1;

Questions

  • Is there a way to to deconstruct object into custom named variables?
  • Does it make sense in terms of performance?
about 4 years ago · Juan Pablo Isaza
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