So it looks like “choice” just takes an element from a list at random. That’s easy enough to do with javascript. I’ll use the first target trial code as an example. The simplest solution is this:

```
n1target = letters[Math.floor(Math.random() * letters.length)];
```

But looking at that code block as a whole, you might want this:

```
letters = ["B", "C", "D", "F", "G", "H", "J", "K", "L", "M", "N", "P", "Q", "R", "S", "T", "V", "W", "X", "Z"];
// Generate a random integer in range 0-length of the letters array
randomIndex = Math.floor(Math.random() * letters.length);
// Get the item at that index
n1target = letters[randomIndex];
// Delete one item at that index
letters.splice(randomIndex,1);
```

Note that I’ve removed the word “var” and just defined the “n1target” and “letters” variables outright. That tells JS that these should be treated as global variables, so they can be accessed from outside the “begin routine” function. (Routines are made up of several different functions, so to reference a variable in both “begin routine” and “each frame” you need to make sure the variable is global.)