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

163
Vistas
How to not mutate an object in javascript and typescript

Hey I have an object and I do not want to mutateit and from what I understand replace does not do that. I am trying to replace a value in the object in the string with something else

Class

export const customer = {
  address: 'You live in addressCity',
  name: 'customerName',
};

ts file
 var city = 'Brazil';
 this.customer.address = this.customer.address.replace('addressCity', this.city);

What can I do to not mutate and still change the customer address in the ts file

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