
previous

page 1
next
Introduction:
This tutorial introduces one of my favourite games, Countries.
I've prepared an array of well known countries for you - all have 10 letters or less and no spaces - 129 in all.
Download countries.js, copy and paste into a new atom file, countries.js and save in a new directory, project_7.
Creating suitable sets
First we have to create many sets like this:
['LEBANON','ALGERIA','OMAN','SUDAN']
Notice how the first letters have to spell out a country also.
So start a new file called countries.html for creating the suitable sets.
Here's the start for you:
<script src='countries.js'></script>
<script>
for (var i=0;i<countries.length;i++) {
var c0=countries[i]; // eg 'LAOS'
var letters=c0.split(''); // eg ['L','A','O','S']
var arr=[]; // for storing the set
for (var j=0;j<letters.length;j++) {
<script>
for (var i=0;i<countries.length;i++) {
var c0=countries[i]; // eg 'LAOS'
var letters=c0.split(''); // eg ['L','A','O','S']
var arr=[]; // for storing the set
for (var j=0;j<letters.length;j++) {
previous
next