Hi,
maybe I missing something but did not you forget to declare the variable code right here:
```
if (last_result.length > 20) {
code = order_by_occurrence(last_result)[0];
```
should not it be:
```
if (last_result.length > 20) {
var code = order_by_occurrence(last_result)[0];
```
All the best. Thanks for this amazing video