basic pseudocode:
-------------------------------
Set ClickState = 0
Do Until ClickState = 10
Case ClickState = 0
msg = "how are you?"
Set ClickState = 1
Case ClickState = 1
msg = "What would you like for breakfast?"
Set ClickState = 2
Case ClickState = 2
msg = "No, you cannot have pizza for breakfast"
Set ClickState = 3
Case ClickState = 3
msg = "Go to school!"
Set ClickState = 4
......
......
msg = "What would you like for dinner?"
Set ClickState = 10
Do Loop
End
---------------------------
There are probably 10 different ways to do that.
I'll leave it to you to translate into javascript.