Week 04: Decisions and Loops

Lecture

This week will be talking about decisions and loops using JavaScript. Decisions are made in code using if statements, i.e. if this value is 5 or above make the background blue if its below 5 make the background red. Loops are one of the main things that makes programming great! We can loop through a large number of tasks and the computer will do those tasks pretty much instantly. For this we use something called a for loop or a while loop.

In Class Assignment

Create a wall paper pattern using loops, if statements and arrays. Try to play with Math.random() as well to create random patterns. Feel free to use images or divs to create this design.

Homework

Create an array of 8 images, double the items in the array by using the “push” function, shuffle the array using a shuffling function and use a loop to place them in the browser window with a unique id and data-id attribute for the two duplicated images. To do this create an array of image objects that have a image file property and a data-id property. Read chapter 4 for a better understanding of decisions and loops.

Week 03: Functions, Methods and Objects

Lecture

This week will be talking about functions, methods and objects using JavaScript.

Download Lecture PDF

In Class Assignment/Homework

Pick a product on Kickstarter and create a simple product webpage. This page should use the JavaScript object literal syntax for all the properties of this product use JavaScript to display all the products properties on the webpage.

The properties should include the name, price, description, image, discount (two week expiration), and price with discount.

Hint: To calculate the expiration date, create a function that uses todays date to calculate the expiration date. Use the date object.

Extra credit: Display all the pledge amounts and rewards.

Week 02: The ABCs of Programming and JavaScript

Lecture

This week will be covering the basics behind object-oriented programming and specifically looking at JavaScript. We will also be discussing how to debug your code using the JavaScript console in the browser.

Download Lecture PDF

In Class/Homework

  1. Create a simple randomly-generating mad libs webpage that has at least 3 sentences. Use arrays, variables, strings, Math.random(), document.getElementById() and textContent to complete this task. If text seems too easy try using images instead. Read Chapters 1 and 2 in the text book to help you with this task.
  2. Find at least one website that uses JavaScript in an interesting way. Email me the link and the reason why you picked it.

Week 01: Review of the Web, HTML and CSS

Lecture

This first class lecture focuses on a review of what you should have already learned in Web Design 1: The basics of the Internet and world wide web, HTML, and CSS. We will also briefly talk about the Four D’s; Discover, Define, Design and Develop. We will also go over what to expect for the rest of the semester.

Download Lecture PDF

Homework

  1. Set up a Dropbox account
  2. Buy server space if you don’t have one already. You can create an account with Dreamhost here: dreamhost.com/promo/edunyu and use the code: NYU13 for the discount.
  3. Send me the email address you used for the Dropbox account and the URL for your blog to dwoo@qc.cuny.edu
  4. Design and build a one page HTML and CSS website about an interest or talent of yours. The topic you choose should inspire the design you create (i.e. if its about the Yankees use the logo, pin stripes, a baseball diamond, etc. in your design).