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

182
Visualizações
Data types, values and objects

I'm getting pretty confused about this data type thing, especially with objects.

I read that a data type is basically an attribute for information/data used in our programs that tell the interpreter what operations can be done with that information without causing errors. Hence, every piece of information has an associated data type.

JS has 7 primitive data types and the data type Object.

Now, suppose that I write:

let person = {
   name: "John",
   age: 39,
};

Every article I found on the web says that person is a variable that store an object.

That's what gets me confused.What I'm asking is, wouldn't be more correct to say that "person is a variable that refers to a value whose data type is Object"?

I'm sure this is just overthinking the topic, however I want to get the correct basics of programming before moving on.

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

0

I think you are way overthinking it for now... Without much talking about typing, because there's much more to it than just Object. Also know that in Javascript, every value is an object, or almost.

What's good to figure out though, as you mentioned: person is a variable that refers to a value.

This is important, that makes all this more obvious:

let person = {name:"John",age:39};
let john = person;
john.age++; // Increase john's age by 1.
console.log(person.age); // 40

As you can see, person and john both refer to the same object. Untill I put another reference on them:

let person = {name:"John",age:39};
let john = person;
john.age++; // Increase john's age by 1.
console.log(person.age); // 40
person = {name:"Mary",age:34};
console.log(john.name) // John

Here, we replace the reference on person. john remains the same. Now both variable have "diverged" from each other.

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