0
에서 작동하지 않는,하지만 첫 번째 조건은 노력하고 있습니다 :IF-다른 조건이 코드를 쓴 자바 스크립트
if(document.getElementById('v').value == Infinity) {
//alert
}
else if(document.getElementById('v').value == -Infinity) {
//alert
}
else if(document.getElementById('v').value == undefined) {
//alert
}
else if(document.getElementById('v').value == isNaN) {
//alert
}
왜이 아닌 다른 조건 (-Infinity
, undefined
, isNaN
) 작동?
어떻게 무한대로 입력 할 수 있습니까? – elclanrs
@elclanrs well 'Infinity'== 강제 변환이 일어나기 때문에 무한대가 참입니다 – axelduch
OP의 유스 케이스 인 경우 문자열과 비교하면 혼란 스럽습니다. – elclanrs