Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Javascript_lecture_at_ALC_2.0_Meetup.pdf

 Javascript_lecture_at_ALC_2.0_Meetup.pdf

An astute introduction to javascript delivered at alc meetup 2.0

Avatar for Justine Philip

Justine Philip

January 13, 2018
Tweet

Other Decks in Programming

Transcript

  1. HTML and CSS are markup languages. Markup languages are used

    to describe and define elements within a document. JavaScript is a programming language. Programming languages are used to communicate instructions to a machine. Programming languages can be used to control the behavior of a machine and to express algorithms.
  2. Web browsers provide a JavaScript console as part of their

    developer tools. This console is useful for the following reasons: • Errors and warnings that occur on a web page are logged into the console. • JavaScript commands for interacting with a web page can be executed in the console. To access, press CTRL + SHIFT + J
  3. Variables can be thought of as named containers. You can

    place data into these containers and then refer to the data simply by naming the container.
  4. ES5 var message = “welcome”; ES6 const message = “This

    is ALC”; let message = “Welcome”;
  5. As a loosely typed language, javascript supports the use variables

    that are not specifically associated with any particular value type and any variable can be assigned (and re-assigned) values of all types:
  6. let name = “worldclassdev”; let age = 12; let christian

    = true; let hobbies = null; let dob = undefined; let greet = function() { console.log(“Domo o!!”); }
  7. if The most common type of conditional is the if

    statement, which only runs if the condition enclosed in parentheses () is truthy. else You can extend an if statement with an else statement, which adds another block to run when the if conditional doesn’t pass. else if You can also extend an if statement with an else if statement, which adds another conditional with its own block.
  8. if (false) { var outcome = "if block"; } else

    if (true) { var outcome = "else if block"; } else { var outcome = "else block"; } ​
  9. “ Functions are one of the fundamental building blocks in

    JavaScript. A function is a JavaScript procedure—a set of statements that performs a task or calculates a value. To use a function, you must define it somewhere in the scope from which you wish to call it -Mozilla Developer Network
  10. A function definition (also called a function declaration, or function

    statement) consists of the function keyword, followed by: • The name of the function. • A list of parameters to the function, enclosed in parentheses and separated by commas.
  11. Defining a function does not execute it. Defining the function

    simply names the function and specifies what to do when the function is called. Calling the function actually performs the specified actions with the indicated parameters. For example, if you define the function square, you could call it as follows: