JavaScript 101

JavaScript is the lingua franca of the modern responsive web, and almost all the pages you interact with online use it in some form or other.  As with the other things we’re learning in this class, our aim is not to memorize every aspect of the language and become experts overnight, but to gain enough understanding of what it is and how it works so that we can ask the right questions when conceiving our own projects and can intelligently leverage the hard work of people who know these things much better than we do.  Thank heavens for JavaScript libraries.

One of these is the Google code-prettify.js library, which is in use on this site and is what makes all of your code examples look nice!


In Class: More hacking with jsBin


We’re going to start by returning to our jsBin example and hack on the JS there to see if we can make changes.

Go to http://jsbin.com/busimo/edit?output, follow the instructions.

The next example illustrates the power of the useful and ubiquitous jQuery library, which lets us do fancy things like extract data from structured markup, with a lot less code than straight JavaScript.  For this example, we’re trying to take the Carleton timeline information from this website and put it into a JS object (for a full description of this method see Dave Ward’s post).

Go to http://jsbin.com/zohawafinu/edit?html,js,output read the comments and try to figure out what’s going on.

The Carleton College timeline used in the second example above

Assignment

Continue your self-directed coding journey by taking one of the JavaScript tutorials on HTML Dog, depending on your familiarity and comfort with the language: beginnerintermediate, or advanced

Your blog post assignment for this week is to reflect on your experience with coding so far, and engage in the debate within the DH community over whether or not humanities students should learn to code.  Your post should include the following:

  • A clear statement in the first paragraph stating your position either for or against.
  • At least one quotation from each assigned reading: Kirschenbaum for, or Donahue against.
  • A discussion of your coding experience prior coding experience
    • At least one code example (wrapped in pre tags) from your own experience coding, either this week or earlier, that supports your position.

References and links to other articles/blog posts on the issue or not required, but will be looked upon kindly.

Resources

Julie Meloni has written several how-to guides for programming, and has very helpfully posted two gentle introductory lectures pitched at Digital Humanists on Slide Share.  We covered some of this material in class, but here are the full lectures to peruse at your leisure.

Leave a Reply

Your email address will not be published. Required fields are marked *