Skip to content

Instantly share code, notes, and snippets.

/*
A short game where the player is required to complete the name of a country. Hints are also given.
*/
var rightHintCharacterAmount;
var leftHintCharacterAmount;
var randomNumber;
var countryChosen;
var countriesArray = [
function foo (str, a) {
eval(str); //cheating
console.log(a, b);
}
var b = 2;
foo( "var b = 3;", 1);//1, 3
function foo (str, a) {
eval(str); //cheating
console.log(a, b);
}
var b = 2;
foo( "console.log(b);", 1 );//2, 1, 2
function foo(str) {
"use strict";
eval( str );
console.log( a ); //ReferenceError: a is not defined
}
foo( "var a = 2;" );
console.log(b);
b=10;
console.log(b);
b=10;
function foo (a) {
console.log(a);
b = 3;
function bar(c) {
console.log(b + c);
}
bar(4);
}
var foo = 2;
foo();
function foo() {
//a variable b is declared a few seconds after running the program
}
function foo() {
var a = 2;
}