Skip to content

SADDA12/Functions-Objects-Assignment

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Functions-Objects-Assignment

Function Basics: Write a function called addNumbers that takes two parameters and returns their sum.

Object Creation: Create an object called person with properties name, age, and gender. Assign values to these properties and print the object.

Function with Object Parameter: Write a function called printPerson that takes a person object as a parameter and prints out their name, age, and gender.

Object Modification: Create a function called incrementAge that takes a person object as a parameter and increments the age property by 1.

Object Cloning: Write a function called cloneObject that takes an object as a parameter and returns a new object with the same properties and values.

Object Comparison: Create two person objects, compare them, and print whether they are equal or not based on their properties.

Function as Object Property: Create an object called calculator with properties add and subtract, which are functions that take two parameters and perform the respective operations.

Object Looping: Write a function called printObject that takes an object as a parameter and prints out all its key-value pairs.

Object Deletion: Create a function called deleteProperty that takes an object and a property name as parameters and deletes that property from the object.

Deep Object Cloning: Write a function called deepClone that takes an object as a parameter and returns a new object with all nested objects cloned as well.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors