Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

156
Visualizações
constructing object with key value and value accepting space in js

I might be wrong , but curious to know whether can i construct an object with key value pair, with value accepting space only

Somehow after parsing i need to get as

properties:
    name:
    value:       //accepting space



let property = { name: {'value':} }; //currently its giving me error like expression expected

I need to give something like this , is it possible in js or in react Any help will be highly appreciated

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can create objects with undefined or null values, like this:

let property = {
  name: undefined,
  value: undefined
}

let null_property = {
  name: null,
  value: null
}

which is the closest you can get to 'empty space' in Javascript, if you mean what I think you mean.

You can't, however, not assign anything at all in your syntax because Javascript requires that something be assigned to every single variable. You can test this by noting that:

let thing;

and

let thing = undefined;

are the EXACT same line of code from your computer's perspective. The first is simply a convenient shorthand way to write the second.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda