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
Building a Function: An accumulator pattern refers to a function that follow these steps: | |
1. Identify the inputs. | |
1a. Array: [], string "", object: {}, number: 0, bollean: true/false | |
2. Write a function definition with those inputs. | |
2a. define parameters () | |
2b. function call/invoking: function(arguments) | |
3. Identify the output, define the result variable, and return it. |
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
Struggling with the for-in loop and the differences between the terminology of -variable, property, key, and value, | |
in relation to Objects and this type of loop. It really wasnt covered very well in Objects | |
or accumulator patterns Lectures for my novice brain. | |
#1 Write a function named invert that takes an object and returns an object | |
where the keys and values have been inverted |
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
var creditCards = ['4916-2600-1804-0530', '4779-252888-3972', '4252-278893-7978', '4556-4242-9283-2260']; | |
function largestNum(array) { | |
var max = 0; | |
var largestSum; | |
for (var i = 0; i < array.length; i++) { | |
var totalOfEachCreditCard = 0; |
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
var creditSum = function(creditNumbers) { | |
var max = 0; // This is the sum of the largest credit card | |
var largestSum; // This represents the string value of the largest credit card. | |
for(var i = 0; i < creditNumbers.length; i++) { | |
var total = 0; | |
var numberString = creditNumbers[i]; |
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
var human = prompt("Add a number between 0 - 1"); | |
var computer = Math.random(); | |
var humanOutcome = ""; | |
var computerOutcome = ""; | |
var rock = "rock"; | |
var paper = "paper"; | |
var scissors = "scissors"; | |
var tie = "Its a tie"; | |
var winner = "Winner winner chicken dinner"; |
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
/* | |
======================================================= | |
** Week 1 - Project 2 ** | |
Below are a number of problems for you to solve | |
using JS. The JS code can be written below each | |
problem. | |
======================================================= | |
*/ |
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
html | |
<!DOCTYPE html> | |
<html > | |
<head> | |
<title>Stupid Button</title> | |
<link rel="stylesheet" href="css/style.css" /> | |
</head> | |
<main id="main-container"> |
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
<!doctype html> | |
<html> | |
<head> | |
<title>Dog Gone Day Pet Nanny</title> | |
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/normalize/3.0.1/normalize.min.css" /> | |
<link rel="stylesheet" href="assets/stylesheets/application.css" /> | |
<link href="https://fonts.googleapis.com/css?family=Raleway|Roboto+Slab" rel="stylesheet"/> | |
</head> |
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
var words= ["goat", "cheese", "milk"]; | |
var pickWord = function() { | |
return words[Math.floor(Math.random() * words.length)]; | |
}; | |
var word = pickWord(); | |
var setupAnswerArray = function(word) { | |
var myArray =[]; |
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
//create an array of words | |
var words =["java","monkey","amazing","pankcake"]; | |
//pick a randon words | |
var word= words[Math.floor(Math.random() * words.length)]; | |
//set up the answer array | |
var answerArray=[]; | |
for(var i=0; i< word.length; i++){ | |
answerArray[i]="_"; | |
} |