Created
May 8, 2016 12:43
-
-
Save flixi/b098d51b887adb21b66de6ea77b66d02 to your computer and use it in GitHub Desktop.
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
// 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.say(3); | |
and a string type | |
this.say("Joshua"); | |
//3.Strings are created with ' or " | |
'Kratt'; | |
"Hello, enemy! "; | |
//4.Strings are concatenated with + | |
"Attack" + "the" + "enemy!"; //= "Attacktheenemy!" | |
"Attack " + "the " + "enemy!"; //= "Attack the enemy!" | |
//5. We can create variables and reuse them | |
var enemy = hero.findNearestEnemy(); | |
this.attack(enemy); | |
this.attack(enemy); | |
//6. If the code repeats - we can use loops | |
// As does while | |
while(true) { | |
this.moveRight(); | |
this.moveUp(); | |
this.moveLeft(); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment