# List Error: is not a uistring

**URL:** <https://forum.code.org/t/list-error-is-not-a-uistring/34232>\
**Category:** Coding and Debugging Help\
**Created:** [February 12, 2021, 9:43pm UTC](https://forum.code.org/t/list-error-is-not-a-uistring/34232 "2021-02-12T21:43:00Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![jdonwells](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/jdonwells/32/7900_2.png) [@jdonwells](https://forum.code.org/u/jdonwells)\
**Post date:** [June 25, 2022, 2:39am UTC](https://forum.code.org/t/list-error-is-not-a-uistring/34232/7 "2022-06-25T02:39:16Z")

</div>

```javascript
setText("gradeOutput", getText("gradeOutput") + gradeList[(gradeList.length - 1)]);

```

Unfortunately, that won’t work. You are set up to add grades, but not remove them. What I recommended over a year ago was this.

```javascript
  setText("gradeOutput", gradeList);

```

Since then it has started to be flagged with a warning. You could use the toString() method of an array to reassure the lint program it is what you intended, but we don’t cover that in CS Principles. You could ignore the warning. It works. That seems like a bad thing to teach.

So now you must use a loop. I would recommend creating a new function like this.

```javascript
function setTextFromArray (id, values) {
  var text = "";
  if (values.length > 0) {
    text = text + values[0];
    if (values.length > 1) {
      for(var i = 1; i < values.length; ++i) {
        text = text + ", " + values[i];
      }
    }
  }
  setText(id, text);
}

```

Teaching them to extend the existing abstraction is a good thing. And the function is based on the list reduce pattern here [Code.org](https://studio.code.org/s/csp5-2020/lessons/10/levels/6). Though I prefer a modified pattern as given here [Everything You Wanted to Know About App Lab Arrays, But Were Afraid to Ask](https://forum.code.org/t/everything-you-wanted-to-know-about-app-lab-arrays-but-were-afraid-to-ask/34277).

---

_[View the full topic](https://forum.code.org/t/list-error-is-not-a-uistring/34232)._
