# Undefined - array issue?

**URL:** <https://forum.kirupa.com/t/undefined-array-issue/215108>\
**Category:** Uncategorized\
**Created:** [February 4, 2007, 1:03pm UTC](https://forum.kirupa.com/t/undefined-array-issue/215108 "2007-02-04T13:03:35Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yossarian](https://avatars.discourse-cdn.com/v4/letter/y/9de0a6/32.png) [@yossarian](https://forum.kirupa.com/u/yossarian)\
**Post date:** [February 4, 2007, 1:03pm UTC](https://forum.kirupa.com/t/undefined-array-issue/215108/1 "2007-02-04T13:03:35Z")

</div>

Why do I get an ‘undefined’ in my \*\*answerText \*\*Text box when I press Hint\_btn but not when I press Show Answers?

Frame 1:

```auto
// Setup variables

var quizTitle = "test";
var questionsDone = 0;

Array.prototype.shuffle = function() {
    var len = i = this.length;

    while (i--) {
        var p = Math.floor(Math.random()*len);
        var t = this*;
        this* = this[p];
        this[p] = t;
    }
};

var questions = new Array();
// the Question, the Hint and the Answer are stored here
questions[0] = ["Word 1","Hint 1","Answer 1 to be added here"]
questions[1] = ["Word 2","Hint 2","Answer 2 to be added here"]
questions[2] = ["Word 3","Hint 3","Answer 3 to be added here"]
questions[3] = ["Word 4","Hint 4","Answer 4 to be added here"]
questions[4] = ["Word 5","Hint 5""Answer 5 to be added here"]

// randomly sort the array
questions.shuffle();

// find out how many questions there are
var numberQuestions = questions.length

stop();

```

Then on the Show Hint button (Frame 2) I have this code:

```auto

on(click){_parent.userAnswer = _parent.HintText.text
    _parent.gotoAndPlay("Showhints");}

```

On Show Hint Frame 4 have this code:

```auto

answerText.text = userAnswer;
HintText.text = questions[questionsDone][1]
stop();

```

Hope this makes sense…

Yossi
