Crenox

Javascript Tutorial For Beginners LearnCode.academy #3

Jul 6th, 2015
250
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.45 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html class="no-js">
  3. <html>
  4. <head>
  5. <meta charset="utf-8">
  6. <title>Javascript</title>
  7. <meta name="description" content="">
  8. <meta name="viewport" content="width=device-width">
  9. <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"/>
  10. <link rel="stylesheet" href="styles/main.css">
  11. </head>
  12.  
  13. <body>
  14. <div class="container">
  15. <div class="jumbotron">
  16. <h1>Let's Learn Javascript!</h1>
  17. <p class="lead">...cause Javascript ROCKS.</p>
  18. </div>
  19.  
  20. </div>
  21. <script src="scripts/main.js"></script>
  22. </body>
  23. </html>
  24. <!-- It's always good to put the script before the body so that it creates a much faster feeling webpage. -->
  25. -------------------------------------------------------------------------------------------------------------------------------
  26. /*
  27. function go(name, age)
  28. {
  29. alert(name);
  30. alert(age);
  31. }
  32.  
  33. go('Sammy', 17);
  34. */
  35.  
  36. /*
  37. When I enter whatever I do in the prompt, that's the return value I give to name
  38. So what happened was prompt had a return value that name recieved
  39. var name = prompt();
  40. */
  41.  
  42. /*
  43. function add(first, second)
  44. {
  45. return first + second;
  46. }
  47.  
  48. alert(add(1, 2));
  49. */
  50.  
  51. /*
  52. function go(name, age)
  53. {
  54. if(age < 20)
  55. {
  56. return name + '!';
  57. }
  58. else
  59. {
  60. return name;
  61. }
  62. }
  63.  
  64. alert(go('Will', 17));
  65. */
  66.  
  67. /*
  68. this variable is undefined since it has no value
  69. var a;
  70. alert (a);
  71.  
  72. every function is going to be undefined unless you give it a return value
  73. function go()
  74. {
  75. var name = "Sam";
  76. }
  77. alert(go());
  78. */
  79.  
  80.  
  81. /** NOTES **/
  82. // Functions in Javascript: piece of code that does one or more actions
  83. // Arguments are useful because they make var's reusable
  84. /*
  85. Dry code is the best way to code because you don't code as much
  86. as possible and the motto for it is: DRY, Don't Repeat Yourself
  87. */
  88. // Functions return values as well
  89. // alert() is essentially like a print statment
  90. // when you call the function print() it brings you to your print screen on your webpage
  91. /*
  92. Once you return something in a function, it marks the end of the function
  93. so if you try to put anything after it'll be ignored
  94. */
  95. /*
  96. There is something in Javascript called undefined, so when something is an
  97. undefined type (something being a variable or function), it means that either
  98. the variable has no value or that the function has no return
  99. */
  100. -------------------------------------------------------------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment