Skip to content

Commit

Permalink
Fix null bypass
Browse files Browse the repository at this point in the history
Fix null bypass
  • Loading branch information
dacoder101 authored Mar 13, 2024
1 parent 627d7b5 commit dce065a
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions script.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
window.onload=function() {
var form = document.getElementById("form")
var stepsElement = document.getElementById("steps")
var sequenceElement = document.getElementById("sequence")
var maxNumElement = document.getElementById("maxNum")

var form = document.getElementById("form")
var stepsElement = document.getElementById("steps")
var sequenceElement = document.getElementById("sequence")
var maxNumElement = document.getElementById("maxNum")
form.addEventListener("submit", (e) => {
e.preventDefault()

form.addEventListener("submit", (e) => {
e.preventDefault()
if !(formElement.value == null) {

var posInt = parseInt(document.getElementById("posIntSub").value)
var sequence = [posInt]
Expand All @@ -15,16 +15,16 @@ window.onload=function() {

while (posInt != 1) {
if (posInt % 2 == 0) {
posInt /= 2
posInt /= 2
} else {
posInt *= 3
posInt += 1
posInt *= 3
posInt += 1
}

sequence.push(posInt)
if (maxNum < posInt) {maxNum = posInt}
}

steps = sequence.length - 1
for (let i = 0; i < sequence.length; i++) {
strSequence += sequence[i] + ", "
Expand All @@ -34,5 +34,5 @@ window.onload=function() {
stepsElement.textContent = String(steps)
sequenceElement.textContent = strSequence
maxNumElement.textContent = String(maxNum)
})
}
}
})

0 comments on commit dce065a

Please sign in to comment.