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
/* | |
* Programming Quiz: Another Type of Loop (6-8) | |
* | |
* Use the existing `test` variable and write a `forEach` loop | |
* that adds 100 to each number that is divisible by 3. | |
* | |
* Things to note: | |
* - you must use an `if` statement to verify code is divisible by 3 | |
* - you can use `console.log` to verify the `test` variable when you're finished looping | |
*/ |
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
/* | |
* Programming Quiz: I Got Bills (6-9) | |
*/ | |
var bills = [50.23, 19.12, 34.01, 100.11, 12.15, 9.90, | |
29.11, 12.99, 10.00, 99.22, 102.20, 100.10, 6.77, 2.22]; | |
var totals = bills.map(function(bill){ | |
bill += (bill * (15/100)); | |
return Number(bill.toFixed(2)); |
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
/* | |
* Programming Quiz: Nested Numbers (6-10) | |
* | |
* - The `numbers` variable is an array of arrays. | |
* - Use a nested `for` loop to cycle through `numbers`. | |
* - Convert each even number to the string "even" | |
* - Convert each odd number to the string "odd" | |
*/ | |
var numbers = [ |
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
/* | |
* Programming Quiz: Bank Accounts 1 (7-3) | |
*/ | |
var savingsAccount = { | |
balance: 1000, | |
interestRatePercent: 1, | |
deposit: function addMoney(amount) { | |
if (amount > 0) { | |
savingsAccount.balance += amount; |
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
/* | |
* Programming Quiz: Facebook Friends (7-5) | |
*/ | |
// your code goes here | |
var facebookProfile = { | |
name: "Claudia", | |
friends: 100, | |
messages: ["Happy birthday", "I love you", "XOXO", "Bless you"], |
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
/* | |
* Programming Quiz: Donuts Revisited (7-6) | |
*/ | |
var donuts = [ | |
{ type: "Jelly", cost: 1.22 }, | |
{ type: "Chocolate", cost: 2.45 }, | |
{ type: "Cider", cost: 1.59 }, | |
{ type: "Boston Cream", cost: 5.99 } | |
]; |
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
var s = "audacity"; | |
var udacityizer = function(s) { | |
// Right now, the variable s === "audacity" | |
// Manipulate s to make it equal to "Udacity" | |
// Your code goes here! | |
s = s.charAt(1).toUpperCase() + s.slice(2); | |
return s; | |
}; |
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
var sampleArray = [0,0,7]; | |
var incrementLastArrayElement = function(_array) { | |
var newArray = []; | |
// Your code should make newArray equal to an array that has the same | |
// values as _array, but the last number has increased by one. | |
// For example: | |
// _array = [1, 2, 3]; | |
// turns into: |
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
var name = "AlbERt EINstEiN"; | |
function nameChanger(oldName) { | |
var finalName = oldName; | |
// Your code goes here! | |
finalName = finalName.toLowerCase(); | |
finalName = finalName.split(" "); | |
finalName = finalName[0].charAt(0).toUpperCase() + finalName[0].slice(1) + " " + finalName[1].toUpperCase(); | |
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
var work = { | |
"jobs": [ | |
{ | |
"employer": "Udacity", | |
"title": "Course Developer", | |
"location": "Mountain View, CA", | |
"dates": "Feb 2014 - Current", | |
"description": "Who moved my cheese cheesy feet cauliflower cheese. Queso taleggio when the cheese comes out everybody's happy airedale ricotta cheese and wine paneer camembert de normandie. Swiss mozzarella cheese slices feta fromage frais airedale swiss cheesecake. Hard cheese blue castello halloumi parmesan say cheese stinking bishop jarlsberg." | |
}, | |
{ |