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
what does ?? mean in JavaScript

I'm curious to know that what does a ?? mean in JS?

form.inputs.forEach(input => {
      stepProperties[input.field] = {
        info: input.fieldInfo,
        description: input.fieldLabel,
        default: input.fieldDefault ?? '',
        ...getInputType(input.fieldType, fieldTypes),
      };
      itemToPush.properties = stepProperties;
    });

in the above code snippet the value of default key is input.fieldDefault ?? ''

would like to understand this line.

I did google but did not get any proper answer.

about 4 years ago · Juan Pablo Isaza
3 Respuestas
Responde la pregunta

0

It's the nullish coalescing operator, if the left side is null or undefined it will return the right side

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Nullish_coalescing_operator

about 4 years ago · Juan Pablo Isaza Denunciar

0

?? is the "nullish coalescing operator" a special case of the "||". It returns the right side operand if the left side operand is falsy.

Source

about 4 years ago · Juan Pablo Isaza Denunciar

0

The nullish coalescing operator (??) is a logical operator that returns its right-hand side operand when its left-hand side operand is null or undefined, and otherwise returns its left-hand side operand.

let input = {};
let variable = input.fieldDefault;

console.log(`variable is undefined : ${variable == undefined}`);

variable = input.fieldDefault ?? '';

console.log(`variable is undefined : ${variable == undefined}`);
console.log(`variable is empty string : ${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