Question: I am new to javascript and I am learning about looping through arrays. Anyways I have an array of prices and an array of names. I want the the output to be: "Name:Price". So for example:
Pound: 454
Half Pound: 227
Quarter Pound: 114
etc....

For some reason however the output that I am getting is a repeat of each name with each price next to it as you can see in the snippet below. Thanks for the help in advance. :)

```js
const salePrices = [454,227,114,28,14,7,3.5];

const names = ['Pound','Half-Pound','Quarter Pound','Ounce','Half Ounce','Quarter Ounce','Eighth'];

for (let i = 0; i < salePrices.length; i++){
  for(let x = 0; x < names.length; i++){
    console.log(`${names[x]}:${salePrices[i]}`)
  }
}
```

Answer: 
You don't need two loop for that. One loop would be enough to get the `index` and then get the `names` and `salePrices` from it as:

```js
const salePrices = [454, 227, 114, 28, 14, 7, 3.5];

const names = [
  "Pound",
  "Half-Pound",
  "Quarter Pound",
  "Ounce",
  "Half Ounce",
  "Quarter Ounce",
  "Eighth",
];

for (let i = 0; i < salePrices.length; i++) {
  console.log(`${names[i]}: ${salePrices[i]}`);
}
```
Yes that's because inner loop is running completely per one iteration of outer loop.
So for every **sales price**, **names** are running full.

If both arrays are already in correct order, you can just use one **for** loop.

```js
const salePrices = [454, 227, 114, 28, 14, 7, 3.5];

const names = [
  "Pound",
  "Half-Pound",
  "Quarter Pound",
  "Ounce",
  "Half Ounce",
  "Quarter Ounce",
  "Eighth",
];

for (var i = 0; i < salePrices.length; i++) {
  console.log(names[i] + ":" + salePrices[i])
}
```