Question: I know there's definitely a better way to do this but I can't seem to figure it out. I know that I need to create a loop but that's about it:

```
function loadData() {
  var getInput1 = localStorage.getItem("input1")
  var parsedInput1 = JSON.parse(getInput1)
  $("#planner-input-1").val(parsedInput1)
  //--------------------------------------

  var getInput2 = localStorage.getItem("input2")
  var parsedInput2 = JSON.parse(getInput2)
  $("#planner-input-2").val(parsedInput2)
  //--------------------------------------

  var getInput3 = localStorage.getItem("input3")
  var parsedInput3 = JSON.parse(getInput3)
  $("#planner-input-3").val(parsedInput3)
  //--------------------------------------

// etc etc etc...

```

Answer: 
You can iterate over the indices, from 1 to however many you have, and concatenate it with `input` to look up the appropriate property on `localStorage`:

```
function loadData(){
  for (let i = 1; i < 10; i++) {
    const parsed = JSON.parse(localStorage.getItem("input" + i));
    $("#planner-input-" + i).val(parsed);
  }
}

```

But it would be better to re-structure your data and HTML - use an array in local storage instead, and use classes instead of IDs, so you can do something like this instead:

```
function loadData(){
  const inputs = document.querySelectorAll('.planner-input');
  const parsedArr = JSON.parse(localStorage.getItem("inputs"));
  inputs.forEach((input, i) => {
    input.value = parsedArr[i];
  });
}

```

Using this method, the first item in the local storage array will correspond to the value to be put into the first `.planner-input`, and so on.
Start a `for` loop from 1 to n

```
function loadData(){
    for (let i = 1; i < 10; i++) {
      const val = JSON.parse(localStorage.getItem("input" + i));
      $("#planner-input-" + i).val(val);
    }
}

```

Here is a [working demo](https://codepen.io/hdas2012/pen/YzPaqwZ)