COMPSCI 220
Programming Methodology
What Have You Learned So Far?
Java Java Java Java
Java!!�+a few algorithms & data structures
Can you just master Java and be done?
No!
Different Tasks => Different Languages
GLShader
Arduino-C
Python
New Languages Show Up At An Unprecedented Rate
The COMPSCI 220 Approach
Thus, what we will teach you:
JavaScript Is Everywhere
JavaScript Is Everywhere
The 220 web-based IDE: Ocelot
A Modern Take On JavaScript �COMPSCI 220-JS: Design to match other languages
What We Will Focus On (A Sampler)
Rules
Rules
13
Grading
Component | Weight |
Projects: programming component | 30% |
Projects: quiz component | 30% |
Mid-Term 1 | 20% |
Mid-Term 2 | 20% |
How To Succeed
JS: Basic Syntax; Using the Console
let a = 42; // Declare a variable, and assign it a number.
let b = 'Hello World'; // A string.
let c = [0, 1, 4, 9]; // An array of numbers.
const pi = 3.14159265359; // A constant.
console.log('The value of pi is ' + pi.toString()); // Print to the console.
console.log(c); // The console can display objects.
let d; // Will not compile: need to initialize value.
// The === operator in JS is equivalent to the == in other languages.
if (1 === 1) {
console.log('All is good.');
}
function factorial(x) {
let y = 1;
for (let z = 1; z <= x; ++z) {
y = y * z;
}
return y;
}
Types in JavaScript
> typeof 1
"number"
> typeof 2.3
"number"
> typeof "Hello, world!"
"String"
> typeof true
"boolean"
Java | JavaScript |
int a = 2; float b = 1.3; double c = 1.3; String d = "Hello world"; | let a = 2; // All numbers are doubles let b = 1.3; let c = 1.3; let d = "Hello world"; |
Note: all numbers have the type "number", which is equivalent to the type double in Java.
Some Small Gotcha Points About JS
Project 1: Image Processing
Removed green and blue
Grayscale
Highlight edges
Blur
COMPSCI 220 Homework
Programming:
Written:
See course website for late policy