1 / 16

CS110: Computer Science and the Internet

CS110: Computer Science and the Internet. - More JavaScript - Ex. on Far <-> Cels - Objects - Object literals - Reassigning variables -Variable swap. Project Requirements due. Question 1 on the quiz. The expression 3+4* 5 A has the value 23 B has the value 35 C has the value 320

morrie
Download Presentation

CS110: Computer Science and the Internet

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. CS110: Computer Science and the Internet - More JavaScript- Ex. on Far <->Cels- Objects- Object literals- Reassigning variables-Variable swap

  2. Project Requirements due

  3. Question 1 on the quiz • The expression 3+4*5 • A has the value 23 • B has the value 35 • C has the value 320 • D depends on the context

  4. Review • Exercise • jQuery • http://cs.wellesley.edu/~cs110/lectures/JSprogramming/#bugs • $(selector).method(stuff); Let’s color all the <h2>’s blue $(‘h2’).css(‘background-color’, ‘red’); $(‘#box_id’).text(“Some text”)

  5. Scott’s notes on Firebug • http://cs.wellesley.edu/~cs110/scott/L09-JS-dates/js-dates.shtml#stepping

  6. Objectify the world! • Has (Properties) • Do (Methods) • Dog, Humans • JavaScript • Browser Window • Document • String • Date

  7. The Date Object HAS DOES getDay() getMonth() getTime()

  8. The Math Object DOES Random() HAS PI http://cs.wellesley.edu/~cs110/lectures/JSDatesEtc/#section_5

  9. Let’s create Objects • var person1 = {name: "Alice", gradYear: 2013, going: "yes"}; • Object-literals • Firebug • http://cs.wellesley.edu/~cs110/lectures/JSDatesEtc/#js_object_literals

  10. jQuery returns objects • Back to Scott’s notes • http://cs.wellesley.edu/~cs110/scott/L09-JS-dates/js-dates.shtml#section_5

  11. Reassigning variables • var count = count + 2; • var answer = prompt (“What is your name?”); answer = “Scott”;

  12. Variable swap • Misplaced letters • Let’s try it in Firebug

  13. Your Questions • Do all methods have () at the end? And do all properties never have () at the end? • What is the difference between an object literal and an array? When would you use either? • Why do we use css in Javascript? (What would be examples of times that this would make sense?)

  14. Shift gears • Back to Hex and Binary!

  15. http://cs.wellesley.edu/~cs110/scott/L07-color-and-images/color-and-images.shtmlhttp://cs.wellesley.edu/~cs110/scott/L07-color-and-images/color-and-images.shtml

  16. Hexadecimal Colors # 94 00 D3 RGB Using hexadecimal colors in CSS: blockquote { color: #9400D3; background-color: #E6E6FA; }

More Related