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

D1ea01ecfeb9f5d9c244f1af9755c512?s=128

Justine Philip

January 13, 2018
Tweet

Transcript

  1. 1.
  2. 2.
  3. 5.
  4. 6.
  5. 7.

    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.
  6. 8.
  7. 9.
  8. 10.

  9. 12.
  10. 13.

    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
  11. 14.
  12. 15.
  13. 16.

    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.
  14. 17.

    ES5 var message = “welcome”; ES6 const message = “This

    is ALC”; let message = “Welcome”;
  15. 18.
  16. 19.
  17. 20.

    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:
  18. 21.
  19. 22.

    let name = “worldclassdev”; let age = 12; let christian

    = true; let hobbies = null; let dob = undefined; let greet = function() { console.log(“Domo o!!”); }
  20. 23.
  21. 26.
  22. 27.
  23. 28.

    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.
  24. 29.

    if (false) { var outcome = "if block"; } else

    if (true) { var outcome = "else if block"; } else { var outcome = "else block"; } ​
  25. 30.
  26. 31.

    “ 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
  27. 33.
  28. 34.
  29. 35.

    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.
  30. 37.
  31. 38.

    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:
  32. 40.
  33. 41.
  34. 44.