cmsc498o_javascript_pt1_01_31_2019.pdf - CMSC498O Javascript \u2013 Part 1 Lecturer Prof Leilani Battle CMSC498O

cmsc498o_javascript_pt1_01_31_2019.pdf - CMSC498O...

This preview shows page 1 - 14 out of 66 pages.

CMSC498O Javascript – Part 1 Lecturer: Prof. Leilani Battle 1/31/19 CMSC498O: llabus 1
Image of page 1
Recap Course overview HTML & CSS 1/31/19 CMSC498O: llabus 2
Image of page 2
Today Javascript! 1/31/19 CMSC498O: llabus 3
Image of page 3
Learning objectives Understanding the basics of Javascript Data types Variables Objects Arrays Loops Functions Goal: to be able to implement simple algorithms and data structures in Javacript 1/31/19 CMSC498O: llabus 4
Image of page 4
Note: we will not be using libraries (yet) Just pure Javascript! 1/31/19 CMSC498O: llabus 5
Image of page 5
Trying things out in Javascript Easy to do (in Chrome): write code in the Developer Tools directly 1/31/19 CMSC498O: llabus 6
Image of page 6
You can also open local html files in Chrome 1/31/19 CMSC498O: llabus 7
Image of page 7
Other options online W3Schools online code editor: Very, very useful to test small things in HTML/CSS/Javascript I used this extensively for the examples in the HTML/CSS lecture! JSFiddle: Useful for writing self-contained examples, including external files Often shared on StackOverflow Many other options as well 1/31/19 CMSC498O: llabus 8
Image of page 8
Comments /* Long comments */ // short comments 1/31/19 CMSC498O: llabus 9
Image of page 9
Data types Primitive data types Boolean – true, false Number – double precision (64 bit), -Infinity, +Infinity, Nan (not-a-number) String Null – null (this is the only value) Undefined – undefined variables that are not assigned a value are undefined 1/31/19 CMSC498O: llabus 10
Image of page 10
Data types Primitive data types Boolean – true, false Number – double precision (64 bit), -Infinity, +Infinity, Nan (not-a-number) String Null – null is the only value Undefined –variables that are not assigned a value are set to undefined Null and undefined are not the same All primitive values are immutable : they cannot be re-assigned 1/31/19 CMSC498O: llabus 11
Image of page 11
Variables Variables are assigned using the “var” keyword: You can check the type of variables using the typeof keyword 1/31/19 CMSC498O: llabus 12
Image of page 12
Variable assignment All primitives are assigned by value Objects and arrays are assigned by reference Yay, no pointers!
Image of page 13
Image of page 14

You've reached the end of your free preview.

Want to read all 66 pages?

  • Spring '19
  • Closure

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture