-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
codecademy unity Gizmotronn/javascript@17fda1f @IrisDroidology
- Loading branch information
1 parent
392e413
commit 2e72697
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# https://codecombat.com/play/level/master-of-names? | ||
|
||
# Your hero doesn't know the names of these enemies! | ||
# Use the findNearestEnemy method on your new glasses. | ||
|
||
# Assign the result of hero.findNearestEnemy() to the variable enemy1: | ||
enemy1 = hero.findNearestEnemy() | ||
# enemy1 now refers to the nearest enemy. Use the variable to attack! | ||
hero.attack(enemy1) | ||
hero.attack(enemy1) | ||
|
||
# Now that enemy1 is defeated, calling hero.findNearestEnemy() again will result in finding the new nearest enemy. | ||
enemy2 = hero.findNearestEnemy() | ||
hero.attack(enemy2) | ||
hero.attack(enemy2) | ||
|
||
# Assign the result of hero.findNearestEnemy() to the variable enemy3: | ||
enemy3 = hero.findNearestEnemy() | ||
|
||
# Now attack using the enemy3 variable: | ||
hero.attack(enemy3) | ||
hero.attack(enemy3) |
2e72697
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JS is quite a lot like Python in terms of operators (see commit linked)