Skip to content

jo-well29/arrays-object-practice

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 

Repository files navigation

arrays-object-practice

Fork and Clone this repo

  1. Create a index.js file.
  2. This is a solo assignment. Be sure to work through these problems on your own.

Problem 1

You have an array called numbers with three elements: [1, 2, 3]. Destructure the array into three separate variables: first, second, and third, and assign the corresponding values. Print the value of second.

Problem 2

Consider the following object:

const person = {
  name: 'John',
  age: 30,
  city: 'New York'
};

Using destructuring, extract the values of name and city from the person object and store them in variables called personName and personCity, respectively. Print the values of both variables.

Problem 3

You have an object called car with the following properties:

const car = {
  brand: 'Toyota',
  model: 'Corolla',
  year: 2022
};

Use Object.keys to extract the keys of the car object into an array called keysArray. Print the keysArray.

Problem 4

Using Object.values, extract the values from the car object defined in the previous problem and store them in an array called valuesArray. Print the valuesArray.

Problem 5

Using Object.entries, extract both the keys and values from the car object defined earlier and store them in an array called entriesArray. Print the entriesArray.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors