...

View Full Version : I would like to make an array containing operations I would like to be carried out.



java n00b
01-02-2011, 05:00 PM
Is it possible to have one of nine elements of an array, each containing code that will fill in a square in a tic-tac-toe game, randomly chosen then the code executed?

If not, can anyone explain why and/or another way to do it?

Philip M
01-02-2011, 05:39 PM
Google is your friend!

mrhoo
01-02-2011, 09:43 PM
Tic tac toe shouldn't be too random...

gizmo1650
01-03-2011, 01:50 AM
x=["alert('hello world')","alert('goodbye world')"];
eval(x[1])
or


x=[function(){alert('hello world')},function(){alert('goodbye world')}]
x[1]()



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum