I am trying to pass a complete JavaScript statement to a function to prevent typing the same code again. I am using a variable but this code does not seem to work. The HTML input is given below.
var e2;
e2 = document.getElementById("num2");
e2.addEventListener('blur', checko(e2));
function checko(k){
alert("Hey you have entered - "+k.value)
}
<input type="text" class="form-control" id="num2" placeholder="0">
This is just a small code of the web page I am building and to validate other inputs I would like to KEEP use a function.