Skip to content

Instantly share code, notes, and snippets.

Last active August 19, 2020 12:55
What would you like to do?
The Assignment / Task for Destructuring

Destructuring Assignment / Task

A task/challenge from my video on Destructring in JavaScript

  • Create an array of objects
  • Each object should contain the data of a browser
  • Store the "company", "name" and "marketShare" in variables for any random item in the array every 2 seconds
  • log "{company} developed {name} which holds {marketShare} of the Market Share" to the console

To get other browser market shares: Browser Market Shares

Example Data:

const browsers = [
    name: "Firefox",
    company: "Mozilla",
    marketShare: "8.01%",
    name: "Chrome",
    company: "Google",
    marketShare: "68.26%",
    name: "Edge",
    company: "Microsoft",
    marketShare: "6.67%",
    name: "Opera",
    company: "Opera Software",
    marketShare: "1.31%",

Hint: use Math.floor(Math.random() * 4) and store it in a variable to get a random number

Hint: use setInterval to repeat the code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment