Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html class="no-js">
- <html>
- <head>
- <meta charset="utf-8">
- <title>Javascript</title>
- <meta name="description" content="">
- <meta name="viewport" content="width=device-width">
- <link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css"/>
- <link rel="stylesheet" href="styles/main.css">
- </head>
- <body>
- <div class="container">
- <div class="jumbotron">
- <h1>Let's Learn Javascript!</h1>
- <p class="lead">...cause Javascript ROCKS.</p>
- </div>
- </div>
- <script src="scripts/main.js"></script>
- </body>
- </html>
- <!-- It's always good to put the script before the body so that it creates a much faster feeling webpage. -->
- -------------------------------------------------------------------------------------------------------------------------------
- /*
- function go(name, age)
- {
- alert(name);
- alert(age);
- }
- go('Sammy', 17);
- */
- /*
- When I enter whatever I do in the prompt, that's the return value I give to name
- So what happened was prompt had a return value that name recieved
- var name = prompt();
- */
- /*
- function add(first, second)
- {
- return first + second;
- }
- alert(add(1, 2));
- */
- /*
- function go(name, age)
- {
- if(age < 20)
- {
- return name + '!';
- }
- else
- {
- return name;
- }
- }
- alert(go('Will', 17));
- */
- /*
- this variable is undefined since it has no value
- var a;
- alert (a);
- every function is going to be undefined unless you give it a return value
- function go()
- {
- var name = "Sam";
- }
- alert(go());
- */
- /** NOTES **/
- // Functions in Javascript: piece of code that does one or more actions
- // Arguments are useful because they make var's reusable
- /*
- Dry code is the best way to code because you don't code as much
- as possible and the motto for it is: DRY, Don't Repeat Yourself
- */
- // Functions return values as well
- // alert() is essentially like a print statment
- // when you call the function print() it brings you to your print screen on your webpage
- /*
- Once you return something in a function, it marks the end of the function
- so if you try to put anything after it'll be ignored
- */
- /*
- There is something in Javascript called undefined, so when something is an
- undefined type (something being a variable or function), it means that either
- the variable has no value or that the function has no return
- */
- -------------------------------------------------------------------------------------------------------------------------------
Add Comment
Please, Sign In to add comment