This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Object Literals | |
//Example 1 ----------------------------------- | |
let superman = { | |
name: "Superman", | |
"real name": "Clark Kent", | |
height: 75, | |
weight: 235, | |
hero: true, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//JavaScript Database Example: JSON | |
let student1 = { | |
"fname": "Jille", | |
"lname": "Bonnefemme", | |
"UOID": 951270007, | |
"classrank": "sophomore", | |
"courses": ["110", "111"], | |
"website": "https://www.uoregon.edu/~jilleb/" | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Creating Elements</title> | |
<style> | |
body { | |
background-color: #0E454C; /* color names also work */ | |
padding: 30px; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//return [1 ..6] | |
let rollDie = () => { | |
return Math.floor(Math.random() * 6) + 1; | |
}; | |
//use a while loop | |
function rollUntil_v1(target) { | |
let count = 0; | |
//priming roll, before the loop |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//return 0 (tails) or 1 (heads) | |
let flipCoin = function() { | |
return Math.floor( (Math.random() * 2) ); | |
}; | |
// return random integer 1 .. max | |
function getRandomInt(max) { | |
return Math.floor(Math.random() * max) + 1; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//From our textbook website | |
//https://www.kirupa.com/html5/the_devowelizer.htm | |
function isVowel(char) { | |
return char == 'a' || | |
char == 'e' || | |
char == 'i' || | |
char == 'o' || | |
char == 'u' || |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//Example: 1st Ten Laws of Advertising | |
//first ten laws of advertising | |
const NUM_OF_LAWS = 10; | |
let result = ""; | |
//count from 1..10 | |
for (let i = 1; i <= NUM_OF_LAWS; ++i) { | |
result = result + "Repetition\n"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const SPEED_LIMIT = 55; //global symbolic constant | |
function amISpeeding(speed) { | |
if (speed > SPEED_LIMIT) { | |
alert("Yes. You are speeding-- $$$ ticket."); | |
} else { | |
alert("No. You are not speeding."); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//jshint esversion: 6 | |
let controller = function() { | |
$.ajax({ | |
url: "http://localhost:8888/todos", | |
method: "GET" | |
}).done((res) => { | |
let pElem; | |
//console.log(res.comments[0]._id + " " + res.comments[0].data) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<h2>CIT Code Portfolio for M. O'Shaunessy</h2> | |
The University of Oregon's Computer Science Department offers a Computer Information Technology minor. | |
The CIT minor prepares students to use and apply technologies in workplace environments that require development and management of databases, computer networks, web applications, and software systems. | |
<h2>CIT Class Projects</h2> | |
The CIT minor consists of six classes: | |
<ol> |
NewerOlder