Created
October 30, 2018 10:03
-
-
Save alpgul/4f21f029edd8e6f25ec94498e8c3a59f to your computer and use it in GitHub Desktop.
JavaScript Syntax
This file contains hidden or 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
| //JavaScript Values | |
| var x, y; // How to declare variables | |
| x = 5; y = 6; // How to assign values | |
| z = x + y; // How to compute values | |
| //JavaScript Literals | |
| Numbers are written with or without decimals: | |
| 10.50 | |
| 1001 | |
| Strings are text, written within double or single quotes: | |
| "John Doe" | |
| 'John Doe' | |
| //JavaScript Operators | |
| arithmetic operators: | |
| (5 + 6) * 10 | |
| assignment operator : | |
| var x, y; | |
| x = 5; | |
| y = 6; | |
| //JavaScript Expressions | |
| 5 * 10 | |
| x * 10 | |
| "John" + " " + "Doe" | |
| //JavaScript Keywords | |
| var x, y; | |
| x = 5 + 6; | |
| y = x * 10; | |
| //JavaScript Comments | |
| var x = 5; // I will be executed | |
| // var x = 6; I will NOT be executed | |
| //JavaScript Identifiers | |
| In JavaScript, the first character must be a letter, or an underscore (_), or a dollar sign ($). | |
| //JavaScript is Case Sensitive | |
| var lastname, lastName; | |
| lastName = "Doe"; | |
| lastname = "Peterson"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment