Making .value value 0 instead of null in javascript
2 1 I have following code: var drikke = parseInt(document.querySelector('input[name="drikke"]:checked').value); if (typeof drikke == null) drikke == 0; How do I make the .value return 0 instead of null , which is ruining my program? javascript share | improve this question edited Nov 13 '18 at 10:33 Tornike Shavishvili 610 2 11 22 asked Nov 13 '18 at 9:02 Ken Ken 38 5 Could you please poste you html part of the code? Thank you. – Tornike Shavishvili Nov 13 '18 at 9:19 add a comment | 2 1 I have following code: var drikke = parseInt(document.querySelector('input[name="drikke"]:checked').value); if (typeof drikke == null) drikke == 0; How do I make the .value return 0 instead of null , which is ruining my program? javascript share | improve this question edited Nov 13 '18 at 10:33 Tornike Shavishvili 610 2 11 22