Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

w2 Quiz - John Hardberger #6

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>

<script src="js/app.js"></script>
</body>
</html>
124 changes: 124 additions & 0 deletions js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
//QUIZ

//PART 1

//1. Create an object that has a property that is an array. Log one of the elements of that array.

const fil = {
age: 27,
height: 'medium',
GAstudent: true,
stuff: [
'laptop', 't-shirt', 'sneakers', 'backpack'
]
};

console.log(fil.stuff[2]);

//2. Create an object that has a property that is an object. Log one of the properties of that inner object.

const link = {
age: undefined,
height: 'short',
GAstudent: false,
sword: {
name: 'Master Sword',
magic: true,
length: 'medium',
}
}

console.log(link.sword.name);

//3. Create an object that has a property that is a function (method). Call that method.

const youngLink = {
age: undefined,
height: 'short',
GAstudent: false,
attack: () => {
console.log('HYAH!')
}
}

youngLink.attack();


//PART 2

//2. Create a function that returns an array. Log an element of the array.

const boatNameSuggestor = () => {
return boatNameList = [
'The Alfalfa', 'The Salty Sardine', 'The Fox Confessor', 'The Marie Antoinette'
];
};

console.log(boatNameSuggestor()[1]);

//3.

const motherShip = {
engines: 8,
class: 'dreadnaught',
launchEscapePod: () => {
return escapePod = {
engines: 2,
class: 'rescue vessle'
}
}
};

console.log(motherShip.launchEscapePod().engines)

//8. Create an object that has a method that returns an object that has an array. Log an element of that array.

const mario = {
favColor: 'red',
mustache: true,
eatsPowerStar: () => {
return rainbowMario = {
favColor: ['red', 'orange', 'yellow', 'green', 'blue', 'pink']
}

}
};

console.log(mario.eatsPowerStar().favColor[3]);


//PART 3

const makeApple = () => {
return 'Have an apple!'
};

const makeEdibleArrangement = (apple) => {
console.log(apple + ' And a banana! And some mangoes!')
};

makeEdibleArrangement(makeApple());


//PART 4

if(true){
const a = 2 + 2;
console.log(a);
}
if(true){
if(false){
console.log('hi');
}
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😬 this is old now so perhaps today you'd get this better


//PART 5

const integerList = [2, 4, 6, 8, 10];