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

155
Vistas
Is there a way to put a specific value instead of a value that is originally needed to be but is undefined in javascript?

I want to make a variable a specific value, when a value originally wanted to put is undefined

Like this in shell script

VALUE=${VALUE1:-0} This means, if there is no VALUE1, then VALUE = 0

How can I put a specific value instead of undefined?

data() {
    return {
      value1: 0,
      value2: process.env.VALUE2 | '', // If process.env.VALUE2 is undefined then make value2 ''
    }
},
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You could make use of the ? operator.

for example, you could check whether there is any value in process.env.VALUE2 like the following:

let variable = process.env.VALUE2 ? 'there is value' : 0

Does process.env.VALUE2 have value? If yes then assign 'there is value' to variable else assign 0 to variable

about 4 years ago · Juan Pablo Isaza Denunciar
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