Skip to content

Instantly share code, notes, and snippets.

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>About Me</title>
<style>
.listitem {
color: red;
}
</style>
var img = document.getElementById('hplogo');
img.width = 400;
img.src = 'http://www.logostage.com/logos/yahoo.GIF';
var button = document.getElementById('gbqfba');
button.innerHTML = 'Yahoooo!';
var readingList = [
{ title : 'y tu mama tambien',
author : 'someone',
alreadyRead : true },
{ title : 'le petite prince',
author : 'someone',
alreadyRead : true }
]
for (var i = 0; i < readingList.length; i++) {
var recipeCard = {
'title': 'tamales',
'servings': 1,
'ingredients': ['masa', 'butter', 'beer'] }
console.log(recipeCard.title);
console.log('Servings: ' + recipeCard.servings);
console.log('Ingredients: ');
for (var i = 0; i < recipeCard.ingredients.length; i++) {
console.log(recipeCard.ingredients[i]);
function squareNumber(num) {
var squaredNumber = num * num;
console.log('The result of squaring the number ' + num + ' is ' + squaredNumber);
return squaredNumber;
}
squareNumber(3);
function halfOf(num) {
var half = num / 2;
function areaOfCircle(radius) {
r = Math.PI * (radius * radius);
rou = Math.round(r)
return "The area for a circle with radius " + radius + " is " + rou;
}
console.log(areaOfCircle(2));
function percentOf(num1, num2) {
n = num1/num2*100;
return num1 + " is " + Math.round(n) + " % of " + num2;
}
console.log(percentOf(2, 4));
function squareNumber(num) {
return "The result of squaring the number " + num + " is " + num*num;
}
console.log(squareNumber(3));
function mixUp(word, other_word) {
return other_word.slice(0, 2) + word.slice(2) + " " + word.slice(0, 2) + other_word.slice(2);
}
console.log(mixUp('cat', 'dog'));
function drEvil(money_amount) {
if (money_amount > 100000) {
return money_amount + " dollars (pinky)";
} else {
return money_amount + " dollars";
}
}
console.log(drEvil(10));