Skip to content

first commit #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
92 changes: 92 additions & 0 deletions halfboyfriend.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
//Number 1
const sumOfNumber = document.querySelector(".sum-of-no");
const arrOfNum = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
let sum = 0;
for(let i = 0; i < arrOfNum.length; i++ ){
sum +=arrOfNum[i]
}
console.log(sum);
sumOfNumber.textContent = sum;

//Number 2
const lengthOfArr = document.querySelector(".len-of-arr")
let items = arrOfNum.length;

console.log(items)
lengthOfArr.textContent = items;

//Number 3
const NumOfChoice = document.querySelector(".num-of-choice");
let num= arrOfNum[5];

console.log(num)
NumOfChoice.textContent = num;

//NEW QUESTION
const arrOfName = ["Peter", "Paul", "Mary", "John", "Jane"];

//Number 1
const firstAndLastName = document.querySelector(".first-and-last-name");
let firstName = arrOfName[0];
let lastName = arrOfName[4];

console.log();
firstAndLastName.textContent = firstName;

//Number 2
const fiveLetterLong = document.querySelector(".five-letters-long");

let letters = arrOfName[0];

console.log(letters)
fiveLetterLong.textContent = letters;

//Number 3
arrOfNum.push("Halfboyfriend");



const arrOfCountry = ["USA", "UK", "Germany", "France", "Nigeria"];

//Number 1
const countryStartingWithN = document.querySelector(
".country-with-starting-with-n"
);
let first = arrOfCountry[4];

console.log(first);
countryStartingWithN.textContent = first;

//Number 2
const countryWithAInMiddle = document.querySelector(
".country-with-a-in-middle"
);
let second = arrOfCountry[2];


console.log(second);
countryWithAInMiddle.textContent = second;

//Number 3
const countryWithAatTheEnd = document.querySelector(".country-with-a-at-end");
let cont1 = arrOfCountry[0];
let cont2 = arrOfCountry[2];
let cont3 = arrOfCountry[3];
let cont4 = arrOfCountry[4];

console.log(cont1)
countryWithAatTheEnd.textContent = cont1;

const arrOfObject = [
{ name: "Peter", age: 30, country: "USA" },
{ name: "Paul", age: 25, country: "UK" },
{ name: "Mary", age: 28, country: "Germany" },
{ name: "John", age: 35, country: "France" },
{ name: "Jane", age: 28, country: "Nigeria" },
];

let start = 0;
for(let i = 0; i > arrOfCountry.length; i++ ){

start += arrOfCountry[i]
}
2 changes: 2 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -59,5 +59,7 @@
</div>
</div>
</div>

<script src="./halfboyfriend.js"></script>
</body>
</html>