Question: I have a condition that triggers a tk\_messageBox. Now, after staying for a period of let's say 10 seconds, I want it to disappear with an "ok" input without any click or interaction from the user. Is there a way that can be done?

```
        if {condition is matched} {
          set input [tk_messageBox -message $message -icon <iconType> -type <messageBoxType>]
         }

```

Answer: 
If you're looking to avoid creating an intermediate array with the `.map`, there's a more *efficient* method without jQuery, which only creates a single array for the output, but it requires more source code:

```
const texts = Array.from(
  document.querySelectorAll('th'),
  th => tx.innerText
);

```

From your original version, you can use jQuery's `.text` by mapping before the `.toArray`:

```js
const texts = $("th").map(function() { return $(this).text(); }).toArray();
console.log(texts);
```

```html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<table>
  <tr><th>foo</th></tr>
</table>
```

But you probably want to use [`.textContent`](http://perfectionkills.com/the-poor-misunderstood-innerText/) instead of `.innerText` instead.
jQuery has its own `.map()` method that will map over a collection. It returns a collection of the results, and you can use `.get()` to convert that to an array at the end.

```
$("th").map((i, el) => el.innerText).get();

```