Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
9f88691
Inline js
John-Alejandro Aug 12, 2021
368d7e5
new folders
John-Alejandro Aug 12, 2021
5bc72da
movie rental total
John-Alejandro Aug 13, 2021
83af326
Pay for hours worked
John-Alejandro Aug 13, 2021
18f9399
Enrollment/Offer Code
John-Alejandro Aug 13, 2021
c65fd16
Hello
John-Alejandro Aug 13, 2021
e9bb2a3
Redo
John-Alejandro Aug 13, 2021
6aa32a7
redo 2
John-Alejandro Aug 13, 2021
fb1d74d
update
John-Alejandro Aug 13, 2021
62766ee
update
John-Alejandro Aug 13, 2021
2f0bdf9
udate 3
John-Alejandro Aug 13, 2021
b3dc86b
udate 4
John-Alejandro Aug 13, 2021
3794d1b
updated work
John-Alejandro Aug 15, 2021
90be9fc
update
John-Alejandro Aug 15, 2021
cd9d65f
update
John-Alejandro Aug 15, 2021
3d96f44
still trying
John-Alejandro Aug 15, 2021
2819fd8
finally
John-Alejandro Aug 16, 2021
3e5c790
got it
John-Alejandro Aug 16, 2021
74ec10c
still working on problem
John-Alejandro Aug 16, 2021
6eba63b
first attemt
John-Alejandro Aug 16, 2021
0b275c7
2
John-Alejandro Aug 16, 2021
a64f90e
moving along on problems
John-Alejandro Aug 16, 2021
6337a3d
loop
John-Alejandro Aug 17, 2021
6e42e79
test commit
John-Alejandro Aug 17, 2021
598dab8
test2
John-Alejandro Aug 17, 2021
150e704
new attempt
John-Alejandro Aug 17, 2021
4d528dd
Created loop files
John-Alejandro Aug 18, 2021
e6ef351
Solved showMultiplication promblem
John-Alejandro Aug 18, 2021
8113602
Correct showMultiplication without extra code line
John-Alejandro Aug 18, 2021
c17d987
oddEven Random Number Code
John-Alejandro Aug 18, 2021
006339b
First attemt at complete for loop questions.
John-Alejandro Aug 18, 2021
d4311e0
Final result with help
John-Alejandro Aug 18, 2021
585bf4a
Calling all Functions added
John-Alejandro Aug 18, 2021
9d7a05a
closing out
John-Alejandro Aug 18, 2021
09bc062
New practice Code Folder
John-Alejandro Aug 18, 2021
ef5b435
Working thru trying examples to better undersatnd
John-Alejandro Aug 18, 2021
3992f9f
Time to move on to next item
John-Alejandro Aug 18, 2021
aac015b
get it right
John-Alejandro Aug 18, 2021
9381562
understanding it a little better
John-Alejandro Aug 18, 2021
83ff60f
switch back to master branch
John-Alejandro Aug 19, 2021
d470f37
trying out assement code question
John-Alejandro Aug 19, 2021
73cbc68
switching branchs
John-Alejandro Aug 24, 2021
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
13 changes: 13 additions & 0 deletions Practice_Code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Practice Code</title>
</head>
<body>
<script src="js/Practice_Code.js"><</script>

</body>
</html>


10 changes: 10 additions & 0 deletions conditional.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Conditinal.html</title>
</head>
<body>
<script src="js/conditional.js"></script>
</body>
</html>
10 changes: 10 additions & 0 deletions external_js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>External JS</title>
</head>
<body>
<script src="js/external.js"></script>
</body>
</html>
11 changes: 11 additions & 0 deletions functions_js..html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>"Welcome to Functions!"</title>
</head>
<body>
<h1>Functions Lecture</h1>
<script src="js/functions.js"></script>
</body>
</html>
15 changes: 15 additions & 0 deletions inline_js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Inline JS</title>
</head>
<body>
console.log("Hello from Inline JavaScript.");
<script>
var userInput = prompt('What is your favorite color?');
console.log('The user entered: ' + userInput);
alert("Great, " + userInput + " is my favorite color too!");
</script>
</body>
</html>
68 changes: 68 additions & 0 deletions js.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>external.js</title>
<script src="js/conditional.js"></script>
</head>
<<body>
<script>
var a = prompt("How many days are you renting The Little Mermaid?");
// console.log('The user entered: ' + userInput);
var num1 = Number(a);
var b = prompt("How many days are you renting Brother Bear?");
// console.log('The user entered: ' + userInput);
var num2 = Number(b);
var c = prompt("How many days are you renting Hercules?");
// console.log('The user entered: ' + userInput);
var num3 = Number(c);
var result = Number(a)+Number(b)+Number(c);
alert("Your total today for your movie rentals is $" + result * 3 );
</script>
<script>
var a = prompt("How many hours did you work for Google this week?");
// console.log('The user entered: ' + userInput);
var num1 = Number(a);
var b = prompt("How many hours did you work for Amazon this week?");
// console.log('The user entered: ' + userInput);
var num2 = Number(b);
var c = prompt("How many hours did you work for Facebook this week?");
// console.log('The user entered: ' + userInput);
var num3 = Number(c);
var result = Number(a * 400)+Number(b * 380)+Number(c * 350);
alert("Your pay check will be $" + result + " for the hours worked this week");
console.log("Cost of Rentals.");
</script>
<script>
var studentReply = prompt("Is the class full?");
// console.log('The user entered: ' + userInput);
var esecondstudentReply = prompt("Does the class conflict with her schedule?");
// console.log('The user entered: ' + userInput);
if (d === no); {
("Enroll");
} else if (e === No); {
} else {
alert("Enroll");
}
alert("Thank you for using school admissions website.")
</script>
<script>
var f = prompt("Has offer expired?");
// console.log("The user entered: " + ussrInput);
var Offer = (i > 2)
if (Offer === yes); {
alert("Apply");
} else {
alert("Do not apply");
}
if (f === No); {
alert("Apply");
} else {
alert("Do not apply");
}
alert("Thank you for your purchase? Ask Cashier about Premium Member Benefits.")
</script>
</body>
</html

>
106 changes: 106 additions & 0 deletions js/Practice_Code.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
"use strict";
console.log("Practice Code Open and Running");

console.log("Hello from Practice Code JS!");
var myStr =45;
// only numbers work in var, no symbols or letters. Show up as undefined.

console.log(myStr)
// console.log will return whatever you type in in quotes as well as any input or stated var or defined item

var howmanyPets =2;
console.log(howmanyPets)

alert("Wow, this is nice when you know what your doing!");
alert("Do you feel like your understand alerts and how they work?");

var userconfirm = confirm("Do you want to remain logged on?");
// useconfirm = confirm -Requires input from user in form of clicking cancel or ok.
// Both alert and userconfirm remove from screen once an action is taken in box.

alert ("The user selected: " + userconfirm)
// // By adding concatenation(+) to alert and enetring input in this case userconfirm you get a true statement. Boolean -True / False

// var userLunch = prompt("What did you have for lunch today?")
// // prompt is always proceeded by a var "name" and can be followed up with alert "comments" and + var "name" input
// alert("The user had " + userLunch + " for lunch!")
function sayHello(name) {
return "Hello, " + name;
// // all functions must be in format shown with () and {} need a return statement
}
console.log(sayHello("codeup"));

var helloMessage = sayHello("John");
console.log(helloMessage);

var myName = "John Alejandro";
console.log(sayHello(myName))

// in order to run or call function - you can use console.log with ( "function name ( and whatever you want it to say"))
// function myPets(name) {
// return "Their names are, " + name;
// }
// // console.log(myPets("Bandit and Coco Chanel"));
//
// function favMovie(name) {
// return "My favorite movie is, " + name;
// }
// console.log(favMovie("The Big Blue"));
// // console.log must be outside {} of function brackets in order to work.
//
// function keepTrying(name) {
// return "Do not give up," + name;
// }
// console.log(keepTrying(" it will get better."));
// // console.log must be outside {} of function brackets in order to work.
//
// function color(name) {
// return "My favorite color is, " + name;
// }
// console.log(color( "red."));
// // console.log must be outside {} of function brackets in order to work.
//
// function underStand(name) {
// return "Are you starting to understand, " + name;
// }
// console.log(underStand("functions?"));
// // console.log must be outside {} of function brackets in order to work.
//
// function oneMore(name) {
// return "Keep it up don't give up on understanding, " + name;
// }
// console.log(oneMore("functions."));
// // console.log must be outside {} of function brackets in order to work.
//
// function noMistakes(name) {
// return "You almost got it with out any " + name;
// }
// console.log(noMistakes("mistakes."));
// // console.log must be outside {} of function brackets in order to work.

var random = Math.floor((Math.random() * 3) + 1);

function isTwo(number) {
console.log("Our number is: " + number);
return number === 2;
}
// console.log(isTwo(random));
// console.log inside function {} calls function and in this case the return is a boolean value second console.log calls function with input

// function calculateTip(tipPercentage,total){
// return tipPercentage * total;
// }
// console.log(calculateTip(.2,20));
// console.log(calculateTip(.5,50));
// console.log(calculateTip(.35,20));
//
// var userBill = prompt("How much was your Bill?");
// var userTip = prompt("How much would you like to tip in a whole number?") / 100;
// // userTip = userTip / 100;
// alert("Thank you so much for your patronage - You will be tipping : $" + calculateTip(userTip,userBill));

function applyDiscount(originalPrice,discountpercent){
return originalPrice -(originalPrice * discountpercent);
}
// function isArray(input) {
// return Array == 0;}
8 changes: 8 additions & 0 deletions js/break_and_continue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
console.log("Break_and_Continue.js is in the \"House\".")



var prompt ("Pick an odd number between 1 and 50?");



132 changes: 132 additions & 0 deletions js/conditional.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
"use strict";

/* ########################################################################## */
console.log("It's working")
/**
* TODO:
* Create a function named `analyzeColor` that accepts a string that is a color
* name as input. This function should return a message that related to that
* color. Only worry about the colors defined below, if the color passed is not
* one of the ones defined below, return a message that says so
*
* Example:
* > analyzeColor('blue') // returns "blue is the color of the sky"
* > analyzeColor('red') // returns "Strawberries are red"
* > analyzeColor('cyan') // returns "I don't know anything about cyan"
*
* You should use an if-else-if-else block to return different messages.
*
* Test your function by passing various string literals to it and
* console.logging the function's return value
*/
function analyzeColor(input) {
if (input === "blue") {
alert("The ocean appears blue.")
} else if (input === "red") {
alert("Your garden roses are a vivid red.")
} else {
alert("I'm not sure what color that is.")

}
}
console.log("The function analyzeColor returns value.");
// Don't change the next two lines!
// These lines create two variables for you:
// - `colors`: a list of the colors of the rainbow
// - `randomColor`: contains a single random color value from the list (this
// will contain a different color every time the page loads)
var colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'];
var randomColor = colors[Math.floor(Math.random() * colors.length)];
/**
* TODO:
* Pass the `randomColor` variable to your function and console.log the results.
* You should see a different message every time you refresh the page
*/
function analyzeColor(input) {
if (input === "blue") {
alert("The ocean appears blue.")
} else if (input === "red") {
alert("Your garden roses are a vivid red.")
} else {
alert("I'm not sure what color that is.")

}
}
console.log("The function analyzeColor returns different values.");
/**
* TODO:
* Refactor your above function to use a switch-case statement
*/
switch (analyzeColor) {
case "blue":
alert("The ocean appears blue.");
break;
case "red":
alert("Your garden roses are a vivid red.");
break;
default:
alert("I'm not sure what color that is.");
break;
}
console.log("Switch-case is working");
/**
*
* TODO:
* Prompt the user for a color when the page loads, and pass the input from the
* user to your `analyzeColor` function. Alert the return value from your
* function to show it to the user.
*/
var analyzeColor = prompt("Pick a color?");
alert("You picked, " + analyzeColor + " that's a nice color.");
/* ########################################################################## */

/**
* TODO:
* Suppose there's a promotion in Walmart, each customer is given a randomly
* generated "lucky number" between 0 and 5. If your lucky number is 0 you have
* no discount, if your lucky number is 1 you'll get a 10% discount, if it's 2,
* the discount is 25%, if it's 3, 35%, if it's 4, 50%, and if it's 5 you'll get
* all for free!.
*
* Write a function named `calculateTotal` that accepts a lucky number and total
* amount, and returns the discounted price.
*
* Example:
* calculateTotal(0, 100) // returns 100
* calculateTotal(4, 100) // returns 50
* calculateTotal(5, 100) // returns 0
*
* Test your function by passing it various values and checking for the expected
* return value.
*/
function calculateTotal(totalAmount,luckyDiscount) {
return totalAmount-(totalAmount * luckyDiscount);

}

/**
* TODO:
* Uncomment the line below to generate a random number between 0 and 6.
* Prompt the user for their total bill, then use your `calculateTotal` function
* and alerts to display to the user what their lucky number was, what their
* price before the discount was, and what their price after the discount is.
*/
// Generate a random number between 0 and 6
// var luckyNumber = Math.floor(Math.random() * 6);

/**
* TODO:
* Write some JavaScript that uses a `confirm` dialog to ask the user if they
* would like to enter a number. If they click 'Ok', prompt the user for a
* number, then use 3 separate alerts to tell the user:
*
* - whether the number is even or odd
* - what the number plus 100 is
* - if the number is negative or positive
*
* if what the user enters is not a number, use an alert to tell them that, and
* do *not* display any of the above information.
*
* Can you refactor your code to use functions?
* HINT: The way we prompt for a value could be improved
*/
Loading