Write a JavaScript Program to Check Whether a Given Value Type is Number or Not
<script>
function number_checker (value) {
if (typeof value == number) {
document.write ("This is a Number");
}
else {
document.write ("This is Not a Number");
}
}
number_checker (3);
</script>
you still have the issue of using antiquated document.write statements that don’t work properly when you put the JavaScript at the bottom of the page where it belongs.
put all JavaScript just before the </body> tag - it has no place anywhere else (apart from a very small number of small scripts that have to go in the head because they need to run before the page starts to load.
never ever use document.wrute - it never works properly when you put your JavaScript where the JavaScript should go - it is as obsolete as Netscape 4 which was the last browser that needed it).
The problem is changing from having the script where you want the output to appear to having the script at the bottom and putting the output where you want it to appear.
This can be done like
<div id="function_result"></div>
var result_holder = document.getElementById("function_result");
result_holder.textContent = number_checker(3);