Advertisement
Patrikrizek

lesson-7-intro

Jun 20th, 2022
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // SYNTAX
  2. // Literals
  3. 10
  4. "Jane"
  5.  
  6. // Variables
  7. var name = "Joe";
  8. var a = 10;
  9.  
  10. const pi = 3.14;
  11. const petrolTankVolume = 50;
  12. const myName = "Patrick";
  13.  
  14. let x = 10;
  15. let y = "Elizabeth";
  16.  
  17. // ARITHMETIC OPERATORS
  18. (2 + 3) * 10
  19.  
  20. // ASSIGNMENT OPERATOR
  21. let n, l;
  22. n = 6;
  23. l = 5;
  24.  
  25. // KEYWORDS
  26. // var let if function
  27.  
  28. // COMMENTS
  29. // This is a comment on one line.
  30.  
  31. /* This is a comment on
  32.     two and more lines. */
  33.  
  34. // IDENTIFIERS
  35. // Names of the variables, example below
  36. var firstName;              // Here the firstName is undefined
  37. firstName = "Patrick";      // Here the firstName is declared
  38.  
  39. // Shorten
  40. var lastName = "Smith";
  41.  
  42. // that is allowed
  43. var anyName
  44. var _name;
  45. var $lastName;
  46.  
  47.  
  48. // Example of Variable usage
  49. var willChange = 0; // This variable will change anytime i rewrite the value of it.
  50. willChange = 5;
  51. //console.log(willChange);
  52.  
  53. const piNumber = 3.14; // Fixed/constant value, cannot be changed.
  54.  
  55. function myFunction(h,g) {
  56.     let sum = 0;
  57.     sum = h + g;
  58.     return sum;
  59. }
  60.  
  61. //console.log(myFunction(7,3));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement