Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SYNTAX
- // Literals
- 10
- "Jane"
- // Variables
- var name = "Joe";
- var a = 10;
- const pi = 3.14;
- const petrolTankVolume = 50;
- const myName = "Patrick";
- let x = 10;
- let y = "Elizabeth";
- // ARITHMETIC OPERATORS
- (2 + 3) * 10
- // ASSIGNMENT OPERATOR
- let n, l;
- n = 6;
- l = 5;
- // KEYWORDS
- // var let if function
- // COMMENTS
- // This is a comment on one line.
- /* This is a comment on
- two and more lines. */
- // IDENTIFIERS
- // Names of the variables, example below
- var firstName; // Here the firstName is undefined
- firstName = "Patrick"; // Here the firstName is declared
- // Shorten
- var lastName = "Smith";
- // that is allowed
- var anyName
- var _name;
- var $lastName;
- // Example of Variable usage
- var willChange = 0; // This variable will change anytime i rewrite the value of it.
- willChange = 5;
- //console.log(willChange);
- const piNumber = 3.14; // Fixed/constant value, cannot be changed.
- function myFunction(h,g) {
- let sum = 0;
- sum = h + g;
- return sum;
- }
- //console.log(myFunction(7,3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement