Skip to content
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
31 changes: 17 additions & 14 deletions index.html
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>Basic Formulas</title>
<script src="./js/formulas.js" charset="utf-8"></script>
</head>
<body>
<h1>Basic Formulas</h1>
<ol>
<li>Open Developer Tools</li>
<li>Select the Console Tab</li>
<li>Begin typing JS functions to test output</li>
</ol>
</body>
</html>

<head>
<meta charset="utf-8">
<title>Basic Formulas</title>
<script src="./js/formulas.js" charset="utf-8"></script>
</head>

<body>
<h1>Basic Formulas</h1>
<ol>
<li>Open Developer Tools</li>
<li>Select the Console Tab</li>
<li>Begin typing JS functions to test output</li>
</ol>
</body>

</html>
80 changes: 40 additions & 40 deletions js/formulas.js
Original file line number Diff line number Diff line change
@@ -1,80 +1,80 @@
// Basic math formulaas
function addition(num1, num2){
return -1;
// Basic math formulas
function addition(num1, num2) {
return num1 + num2;
}

function subtraction(num1, num2){
return -1;
function subtraction(num1, num2) {
return num1 - num2;
}

function multiplication(num1, num2){
return -1;
function multiplication(num1, num2) {
return num1 * num2;
}

function division(num1, num2){
return -1;
function division(num1, num2) {
return num1 / num2;
}

// Area formulaas
function areaSquare(side){
return -1;
// Area formulas
function areaSquare(side) {
return Math.pow(side, 2);
}

function areaRectangle(length, width){
return -1;
function areaRectangle(length, width) {
return length * width;
}

function areaParallelogram(base, height){
return -1;
function areaParallelogram(base, height) {
return base * height;
}

function areaTriangle(base, height){
return -1;
function areaTriangle(base, height) {
return (base * height) / 2;
}

function Circle(radius){
return -1;
function Circle(radius) {
return Math.pow(radius, 2) * Math.PI; // Math.PI uses the number PI & Math.Pow(X,Y) X to the power of Y
}

function Sphere(radius){
return -1;
function Sphere(radius) {
return 4 * Math.PI * Math.pow(radius, 2);
}

// Surface Area formulas
function surfaceAreaCube(side){
return -1;
function surfaceAreaCube(side) {
return 6 * Math.pow(side, 2);
}

function surfaceAreaCylinder(radius, height){
return -1;
function surfaceAreaCylinder(radius, height) {
return 2 * Math.PI * radius * height;
}

// Perimeter formulas
function perimeterSquare(side){
return -1;
function perimeterSquare(side) {
return 4 * side;
}

function perimeterRectangle(length, height){
return -1;
function perimeterRectangle(length, height) {
return 2 * length + 2 * height;
}

function perimeterTriangle(side1, side2, side3){
return -1;
function perimeterTriangle(side1, side2, side3) {
return side1 + side2 + side3;
}

function perimeterCircle(diameter){
return -1;
function perimeterCircle(diameter) {
return Math.PI * diameter;
}

// Volume formulas
function volumeCube(side){
return -1;
function volumeCube(side) {
return Math.pow(side, 3);
}

function volumeRectangular(length, width, height){
return -1;
function volumeRectangular(length, width, height) {
return length * width * height;
}

function volumeCylinder(radius, height){
return -1;
function volumeCylinder(radius, height) {
return Math.PI * Math.pow(radius, 2) * height;
}