Challenge: Merging Objects and Adding Properties
Task
Create a script that performs the following tasks:
- Merge the properties of two objects,
personInfo
andjobInfo
, and store them in a new object namedfullInfo
. - Add a new property to the
fullInfo
object namedisRetired
with a value offalse
. - Use a
for...in
loop to iterate throughfullInfo
, and log each property and its corresponding value in the format:[property]: [value]
.
Expected output:
- Use the spread operator (
{ ... }
) to merge properties frompersonInfo
andjobInfo
intofullInfo
. - After merging, add a new property to
fullInfo
. - Iterate through
fullInfo
using afor...in
loop to log the properties and their values.
Tudo estava claro?
Conteúdo do Curso
JavaScript Data Structures
JavaScript Data Structures
1. Introduction and Prerequisites
2. Objects Fundamentals
3. Advanced Object Manipulation
Challenge: Merging Objects and Adding Properties
Task
Create a script that performs the following tasks:
- Merge the properties of two objects,
personInfo
andjobInfo
, and store them in a new object namedfullInfo
. - Add a new property to the
fullInfo
object namedisRetired
with a value offalse
. - Use a
for...in
loop to iterate throughfullInfo
, and log each property and its corresponding value in the format:[property]: [value]
.
Expected output:
- Use the spread operator (
{ ... }
) to merge properties frompersonInfo
andjobInfo
intofullInfo
. - After merging, add a new property to
fullInfo
. - Iterate through
fullInfo
using afor...in
loop to log the properties and their values.
Tudo estava claro?