Skip to content

Instantly share code, notes, and snippets.

@sandrabosk
Created July 10, 2020 15:16
Show Gist options
  • Save sandrabosk/2207b831afe6677119b504e60f8e7f4c to your computer and use it in GitHub Desktop.
Save sandrabosk/2207b831afe6677119b504e60f8e7f4c to your computer and use it in GitHub Desktop.

Use the given array and iterate over it:

  • using for loop
  • using .forEach() method and show the index of each element next to the element itself.
const fruits = ['apple', 'plum', 'strawberries'];

// for loop
// ... your code here

// .forEach() method showing the index of each element
// ... your code here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment