when i put one '=' instead of two or three equal character between two elements,the program goes wrong and it doesn't work properly i'd like to know why i can't make two element of different types equal to each other by one equal sign(=) but i can do with three or two but they aren't same type look at my code:
const progress=document.getElementById('progress')
const prev=document.getElementById('prev')
const next=document.getElementById('next')
const circles=document.querySelectorAll('.circle')
let currentActive=1
next.addEventListener('click',()=>{
currentActive++
if(currentActive>circles.length){
currentActive=circles.length
}
update()
})
prev.addEventListener('click',()=>{
currentActive--
if(currentActive<1){
currentActive=1
}
update ()
})
function update(){
circles.forEach((circle,idx)=> {
if(idx<currentActive){
circle.classList.add('active')
}else{
circle.classList.remove('active')
}
})
const actives=document.querySelectorAll('.active')
progress.style.width=(actives.length - 1) / (circles.length - 1) * 100 + '%'
if(currentActive=== 1){
prev.disabled=true
}else if(currentActive === circles.length){
next.disabled=true
}else{
prev.disabled=false
next.disabled=false
}
}
current active is a variable which contains number and circles.length is an element which contains number. although they aren't same type,when i put three equals,program runs correctly but when i put one equal it doesn't. it should be opposite because they can't be same type.