This file contains 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
<!-- I added the .toUpperCase() function to my original script so the user should be able to type answers either capitalized or lowercase --> | |
<script> | |
var answer1 = prompt("Welcome to Harry Potter trivia! (Special Hermione Granger Edition) What is Hermione Granger's middle name?"); | |
while (answer1.toUpperCase() !== "JEAN") { | |
var answer1 = prompt("Nope! Try again"); | |
} | |
if (answer1.toUpperCase() === "JEAN") { | |
alert("Correct!"); | |
} | |
else { |
This file contains 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
It's not very helpful :-( | |
1. Untitled Section | |
1. Untitled Section | |
2. Untitled Section | |
3. Untitled Section | |
4. Untitled Section | |
1. Untitled Section | |
5. Untitled Section | |
6. Untitled Section |
This file contains 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
<script> | |
var Animal = function(s,f,n) { | |
this.speed = s; | |
this.focus = f; | |
this.name = n; | |
this.position = 0; | |
this.report = function() { | |
return this.name + " is at " + this.position; | |
}; | |
this.run = function() { |
This file contains 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
.header { | |
width: 100%; | |
height: 50px; | |
} | |
h1 { | |
text-align: center; | |
font-size: 24px; | |
} | |
.grass { | |
background-color: lightgreen; |
This file contains 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
.header { | |
width: 100%; | |
height: 50px; | |
margin: auto; | |
text-align: center; | |
} | |
h1 { | |
text-align: center; | |
font-size: 24px; | |
} |
This file contains 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
// creating a JSON object that contains all my cats | |
"allMyCats": [ | |
{"name": "Maxwell", "color": "black", "type: "Burmese"}, | |
{"name": "Gracie", "color": "black and white", "type: "American shorthair"}, | |
{"name": "Gizmo", "color": "tabby", "type: "unknown"} |
This file contains 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
// using a get ajax request to access the JSON endpoint created in question #4 | |
$.get("http://localhost:3000/cats", function(response) { | |
// replacing the text of the element with id="putCatHere" with the JSON data that is returned from the endpoint | |
$("#putCatHere").text(response); | |
}); |
This file contains 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
hours_per_year = 24 * 365 | |
puts "The number of hours in a year is #{hours_per_year}" | |
mins_per_decade = 60 * 24 * 365 * 10 | |
puts "The number of minutes in a decade is #{mins_per_decade}" | |
age_in_seconds = 60 * 60 * 24 * 365 * 26 | |
puts "I have been alive for about #{age_in_seconds} seconds" | |
authors_age = 1160000000 / 60 / 60 / 24 / 365 |
This file contains 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
puts "Hello! What's your first name?" | |
first_name = gets.chomp | |
puts "What about your middle name? Don't be embarassed!" | |
middle_name = gets.chomp | |
puts "And finally, your last name!" | |
last_name = gets.chomp | |
puts "So your full name is #{first_name} #{middle_name} #{last_name}? That's a good name!" | |
puts "What's your favorite number, #{first_name}?" |
OlderNewer