Skip to content

Commit

Permalink
#2
Browse files Browse the repository at this point in the history
  • Loading branch information
ProgrammerDATCH committed Feb 14, 2024
1 parent 39c73a0 commit 0f5b2e8
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 9 deletions.
1 change: 0 additions & 1 deletion .gitignore

This file was deleted.

39 changes: 39 additions & 0 deletions JavascriptFunctions/ArrayManipulation.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// console.log("Hello, World!");
function calculateAverageInArray(arr) {
let sum = 0;
for (let i = 0; i < arr.length; i++) {
sum += arr[i];
}
let average = sum / arr.length;
return average;
}


let arr1 = [6, 1, 3, 5, 9, 10, -1];
console.log(get2LargeNumbers(arr1));


function get2LargeNumbers(arr) {
let firstLargeNumber = arr[0];
let firstLargeNumberIndex = 0;
//getting first large Number in the array
for (let i = 0; i < arr.length; i++) {
if (arr[i] > firstLargeNumber) {
firstLargeNumber = arr[i];
firstLargeNumberIndex = i;
}
}
//getting the second large number in the array
let secondLargeNumber = (firstLargeNumberIndex == 0) ? arr[1] : arr[0];

for (let i = 0; i < arr.length; i++) {
if (firstLargeNumberIndex != i) {
if (arr[i] > secondLargeNumber) {
secondLargeNumber = arr[i];
}
}
}

let resultArr = [firstLargeNumber, secondLargeNumber];
return resultArr;
}
43 changes: 35 additions & 8 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,28 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>All Andela Works</title>
<style>
:root {
--bg-color: #121212;
--accent-color: #fff;
}

body {
background-color: #1a1a1a;
color: #fff;
background-color: var(--bg-color);
color: var(--accent-color);
font-family: Arial, sans-serif;
margin: 0;
padding: 0;
display: flex;
flex-direction: column;
min-height: 100vh;
}

.container {
flex: 1;
max-width: 800px;
margin: 20px auto;
padding: 20px;
background-color: #333;
background-color: #444;
border-radius: 10px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}
Expand All @@ -27,7 +36,7 @@
}

.card {
background-color: #444;
background-color: var(--bg-color);
padding: 20px;
margin-bottom: 20px;
border-radius: 5px;
Expand All @@ -36,9 +45,21 @@

.footer {
text-align: center;
margin-top: 20px;
margin-top: auto;
padding: 20px;
color: #888;
}

a button {
font-size: 15px;
border-radius: 20px;
border: none;
background-color: var(--accent-color);
color: var(--bg-color);
padding: 10px 13px;
font-weight: bold;
cursor: pointer;
}
</style>
</head>
<body>
Expand All @@ -48,12 +69,18 @@ <h1>All Andela Works</h1>
<div class="card">
<h2>SnapChat Login Page</h2>
<p>This is a SnapChat Login Page designed with HTML, CSS and JavaScript.</p>
<a href="SnapChat/">View Project</a>
<center><a href="SnapChat/"><button>View Project</button></a></center>
</div>
<div class="footer">
<p>Belongs to David</p>
<div class="card">
<h2>New Project Loading...</h2>
<p>I am currently working on a new project that will blow your mind 🤗.</p>
<!-- <center><a href="#"><button>View Project</button></a></center> -->
</div>
</div>

<div class="footer">
<p>David - ProgrammerDATCH</p>
</div>

</body>
</html>

0 comments on commit 0f5b2e8

Please sign in to comment.