Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
var beatle1="paul";
var beatle2="john";
var beatle3="george";
var beatle4="ringo";
var randomNumber = Math.floor( 1 + Math.random() * 4 );
alert(randomNumber + ": " + window['beatle' + randomNumber] );
<script type="text/javascript">
var beatle1="paul";
var beatle2="john";
var beatle3="george";
var beatle4="ringo";
function randomBeatle() {
var a = Math.ceil(Math.random() * 4);
var b = window["beatle" + a];
alert(b);
}
</script>
<input type="button" value="click me" onclick="randomBeatle()" />
<script type="text/javascript">
var beatle0="paul";
var beatle1="john";
var beatle2="george";
var beatle3="ringo";
function random(){
var rannum=Math.floor(Math.random()*4);
var ranbeatle = "beatle" + rannum;
eval("alert(eval(ranbeatle))");
}
</script>
<button onclick="random()">random</button>
I provided an actionscript solution in the javascript forums so technically I pulled an eval and a me.cLFlaVA said:oh god, he pulled an "eval"...