1 / 14

Introduction to Programming (in JavaScript)

Introduction to Programming (in JavaScript). David Stotts Computer Science Department UNC Chapel Hill. The Big Six. 0. data ( types, simple information ) 1. data storage ( variables, assignment ) 2. data retrieval ( expressions, evaluation ) 3 . repetition ( loops )

jovita
Download Presentation

Introduction to Programming (in JavaScript)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Programming(in JavaScript) David Stotts Computer Science Department UNC Chapel Hill

  2. The Big Six 0. data (types, simple information) 1. data storage (variables, assignment) 2. data retrieval (expressions, evaluation) 3. repetition (loops) 4. decision making (conditionals) 5. procedure abstraction (functions) 6. data abstraction (arrays) 7. objects: all-the-above, wrapped up

  3. 0. Databefore the big 6 there is an item 0 • We can’t study data storage and retrieval without knowing what “data” is Datathe basic symbols and information that a computer manipulates • Data is why we write programs in the first place… we have questions, we want answers • Want information we have (input) turned into new information we need (output)

  4. Data Input information we have and want a program to work on… we have to get it from the user and make it available to the program, in the computer memory Output the new info we expect the program to produce, to generate, to compute… we have to get it out of the program and back to the user in a form the user can consume and employ I/O is the term we use

  5. Von Nuemann Model of a Computer computer I/O Cloud, etc.

  6. DataJavaScript native types, “built in” Number 4, 10, -23, 729358, -414, 0 3.14159, -21.15, 7.0, 1101.1 5.3e7 17.336e-14 0.000031 integers and reals

  7. DataJavaScript native types, “built in” String “tarheels” “x” “3.14159” “(919) 555-1212” “xp @ aol.com” “hola ! !” “$ntko # &”

  8. DataJavaScript native types, “built in” Boolean • true, false (yes, no) are the only values • the basis for “logic”

  9. Dataoperations on native types Number + - / * % 4+5  9 23.4 + 9.3  32.7 -2 * 7  -14 3.4 – 1.1  2.3 7/2  3.5 53 % 12  5 “mod”

  10. Dataoperations on native types Text + concat substring “abc” +“123”  “abc123” we call this concatenation “abc”.concat(“123”)  “abc123” “tarheels”.substring(3)  “heels” “tarheels”.substring(0,2)  “tar”

  11. Dataoperations on native types Boolean && || ! true && true  true AND true && false  false false && false  false true || false  true OR true || true  true false || false  false !false  true NOT !true  false

  12. Dataoperations on native types Comparisons 5 < 8  true less than 17 <= 3.28  false less than or equal 21.4 > -34  true greater than 1.0 >= 1.1  false greater than or equal 12.3 == 2.8  false equal to -3 != -3.1  true not equal to

  13. Dataoperations on native types Comparisons work on strings too “hello” < “world”  true alpha order-ish “bigfoot” > “big”  true “tar” == “tarheels” false “tar” < “tarheels”  true (it’s shorter) “Upper” != “upper”  true case matters “upper” > “Upper”  true (seems strange) “5” > “4”  true these are not numbers “5” > “40”  true remember… alpha order

More Related