Monday, December 12, 2016

Example of the previous post rewritten in Javascript

<html>

<head>

</head>

<body>
<script>

var cars = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"];
var trucks = ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l"];

var x = Math.floor((Math.random() * 10) + 1);

var y = Math.floor((Math.random() * 10) + 1);

var carsandtrucks = cars[x] + trucks[y];

document.write(carsandtrucks);

</script>
</bocy>
<html>