<input type="password" id="pw"> <button id="btn">sub</button>
btn.onclick = function () { if (pw.value.length == 0) { console.log('pw is null'); } else if (isNaN(pw.value)) { console.log('number required'); } else if (pw.value.length < 6) { console.log('length < 6'); } else { console.log(pw.value); } }