Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

121
Views
Two objects javascript. I am bit confused

I'm a bit confused with JavaScript's objects. I want the following :

function to accept as the first parameter the object person, and as the second parameter the name field. It will modify the person object, in which the field (property) name of the object person to receive the value that passed as the second parameter. The function will not return anything, it will modifies the object directly.

Take the following piece of code:

let person = {
  name: "name",
};

let name = {
  name: "name_02",
};

let b = person === name;

function setName(person, name) {}
console.log(b);

I am sure that my code is miserable because I am a beginner, please help me with clarifications and your understanding.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your not a million miles away. The question is asking you to create a function that can be called on a person object, and set it's name using the second parameter.

So you created the function with the 2 params, but just have not done anything with it yet.

Not sure what your trying to do with the comparison part, as that's not in the question anyway.

Your probably after something like ->

let person = {
  name: "name",
};

function setName(person, name) {
  person.name = name;
}

console.log(person);
setName(person, 'Bob');
console.log(person);

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!