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
// Stock Market Profit | |
// Source: InterviewCake | |
// Write an function called getMaxProfit that takes in an array of stock prices and returns the best profit you could have made from 1 purchase and 1 sale. The prices in the array are in the sequence in which they were purchased and can only be sold after it was first purchased. | |
// Input: getMaxProfit([10, 7, 5, 8, 11, 9]) | |
// Output: 6 ..this is the result of 11 - 5 | |
const getMaxProfit = arr => { | |
let max_profit = 0; | |
for (let i = 1; i < arr.length; i++) { // buy |
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>Task 3.2</title> | |
</head> | |
<body> | |
<h1>JavaScript Variables</h1> | |
<p id="UID">In this task, x, y, and z are variables</p> | |
<script> |
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>Task 3.1.2</title> | |
</head> | |
<body> | |
<h1>What can JavaScript Do?</h1> | |
<p>JavaScript can manipulate HTML attrbutes</p> | |
<p>Change the src (source) attribute of an image with JAVASCRIPT</p> | |
<button onclick="document.getElementById('myImage').src='images/shark1.jpg'">GIVE ME A HAMMERHEAD SHARK</button> |
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>Task 3.1</title> | |
<style type="text/css"> | |
#button1 { | |
height: 50px; | |
width: 200px; | |
background: linear-gradient(blue, yellow, green); | |
} |