This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* ////////////////////////////////////////////////////// | |
// STRINGS, NUMBERS, VARIABLES AND LOOPS // | |
//////////////////////////////////////////////////////*/ | |
// 1. Single-line comments start with two slashes. | |
/* Multiline comments start with slash-star, | |
and end with star-slash */ | |
// 2. JavaScript has a number type |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Your goal is to keep at least one flower alive for 60 seconds. | |
// set 3 new locations | |
var LOCATIONS = [ | |
{x: 72, y: 44}, | |
{x: 49, y: 59}, | |
{x: 50, y: 25}, | |
{x: 23, y: 43} | |
]; | |
// loop through all locations | |
// build a tower on each of them |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function summonHero (name, position) { | |
return { | |
say: function (sentence) { | |
alert(sentence); | |
}, | |
move: function (position) { | |
console.log('Moving to x=' + position.x + ' and y=' +position.y); | |
this.pos = position; | |
}, | |
name: name, |