Build your own Instagram-like filters to transform your images
Available on CS 105 Website
Due: Tomorrow, Feb. 17, 8:00pm
Labs so far will be graded generously, if you did the lab you'll earn all the points.
Gradebook online soon, no major grades so far.
Midterm 1 is Tuesday, March 3rd, 8:00pm-9:30pm
Two weeks from tomorrow!
No class on Wednesday after midterm
Conflict: Wednesday, March 4th, 8:15am-9:45am
Sign-ups will be available by Wednesday
25-35 Multiple Choice Questions
2-4 Free Response Questions
Practice exams will be going up on the course website
var num = 43; var x = 31;
var s = "Hello, world"; var s2 = "ABC";
var square = function(x) { return x * x; };
var pixel = img.getRGB(x, y); img.setRGB(x, y, pixel);
Arrays are a fancy name for a list of variables
Define an array by putting comma-separated values within square brackets:
var a = [ 93, 97, 82 ];
Access a value by using square brackets on the array variable and giving an index:
var x = a[0]; // 93 var y = a[1]; // 97 var z = a[2]; // 82
Array variables, like strings, have a .length
property.
var a = [ 93, 97, 82 ]; var len = a.length; // 3
Suppose you have an array containing your grades on three assignments. What is your average grade?
var a = [ 93, 97, 82 ];
Suppose there is a sale where items over $20.00 are 30% off. What is the total, after-sale price of the order?
var items = [ 10.50, 22.30, 82.13, 4.32, 53.21 ];
Strings can also be treated as an array of characters (one letter strings).
var s = "Illinois"; var c = s[0]; // "I"
We can join two Boolean expressions together with && for AND, || for OR.
if (a >= 20 && a <= 50) { ... }
if (a >= 20) { if (a <= 50) { ... } }
if (a <= 20 || a >= 50) { ... }
if (a <= 20) { ... } if (a >= 50) { ... }
// Will NOT work if (20 <= a <= 50) // ...read as: if ((20 <= a) <= 50)