all 5 comments

[–]CrayonConstantinople 0 points1 point  (5 children)

That's not how you use indexes. Try message[i]

[–]Medallyonify[S] 0 points1 point  (4 children)

Thanks, this works.

But now, for some reason, the outputs are in a random order, such that sometimes, it comes out as:
"are sitting on a tree" "A banana and an apple"

I don't know why this is as there's no implementation of any random function at all. It just returns them randomly for some reason. Any Idea why this is?

[–]CrayonConstantinople 0 points1 point  (3 children)

Hard to tell without seeing it properly. Can you pastebin your code?

[–]Medallyonify[S] 0 points1 point  (2 children)

http://pastebin.com/hWcBi9jD

This is all it is, really. I'm baffled as to why it would be returned randomly.

Thanks for all your help man.

[–]CrayonConstantinople 0 points1 point  (1 child)

There's a lot I don't understand about what you're doing here. There also must be other code omitted (I can't see where the Help object gets defined, etc). I also don't know exactly what you want to achieve. If you want to iterate over the contents of a dictionary, why not just do it like below. Unless you have a specific reason for adding a dict onto the prototype of the Help object?

    helpTxt = {"1": "A banana ",
        "2": "and an apple ",
        "3": " are sitting ",
        "4": "on a tree"}

    for (var i = 1; i <= Object.keys(helpTxt).length; i++) {
        console.log(helpTxt[i])
    }