0

How do I use booleans with conditional statements in javascript?

This case I want it when 7 is typed it should show can’t use such name but when other numbers are typed it should show wick <label>nme</label> <input id="o" type="number" placeholder="your name" required> <button onclick="f()" > calculate </button> function f() { var o = 7; document.getElementById("o").value; if (o == 7) { alert("cant you such name"); } else if (o === 7 ) { alert ("wick"); } else { alert("leave"); } }

5th Apr 2018, 12:52 PM
klisco1
4 Answers
0
Thanks , it worked
5th Apr 2018, 1:12 PM
klisco1
0
How do I use alphabet instead of numbers ?
5th Apr 2018, 1:34 PM
klisco1
0
how can we replace if statement blocks with boolean?
7th Apr 2018, 4:16 AM
Claire
0
like boolean in python. and, or, not in place of if and elif. so can we do that?
7th Apr 2018, 6:46 AM
Claire