Skip to content
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

working on it #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
working on it
rayfinn55 committed Feb 22, 2021
commit 4540e2e01d94b6a6db0bdc3fbcbd80d58f4c7f0c
7 changes: 7 additions & 0 deletions numberStatistics.html
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@
<html>
<head>
<title>Number Statistics</title>
<script src="numberStatistics.js" defer></script>
</head>
<body>
<h1>Number Statistics</h1>
@@ -24,5 +25,11 @@ <h1>Number Statistics</h1>
and the third paragraph should show the minimum value.
</li>
</ul>
<input type="number" id="number-statistics" placeholder="enter a number...">
<button onclick="onSubmit()" id="button">submit</button>
<p id="average">average</p>
<p id="min"></p>minimum<br>
<p id="max"></p>maximum<br>
<ul id="numbers">numbers list</ul>
</body>
</html>
35 changes: 35 additions & 0 deletions numberStatistics.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
function onSubmit() {
//get user input from DOM
const num1 = Number(document.querySelector('#number-statistics').value)

const li = document.createElement('li')

li.textContent = num1

const list = document.querySelector('#numbers')

list.appendChild(li)

//const num1 = Number(value) : these are the same
//const num2 = parseInt(value)
//convert input to a number
//create a new li and make its text content equal to users input
//get the ul from the DOM
//append users input to the ul
}


function onSubmit() {
const num1 = Number(document.querySelector('#number-statistics').value)
const li = document.createElement('li')
const ul = document.getElementById('numbers')
li.textContent = num1
ul.appendChild(li)
console.log(ul.children)

let allNum = document.querySelectorAll('##number-statistics li')
for(let i = 0; i < allNum.length; i++) {

}

}
Loading