I wrote the following JavaScript functions :
<script type=text/javascript>
function showVariable(val){
if(typeof(val)!=null && typeof(val)!=false &&typeof(val)!=NaN && typeof(val)!=undefined)
return typeof(val);
else
return val;
}
function print(){
var val = {1, 2, 3};
var res = showVariable(val);
alert(res);
}
</script>
Currently, I can see the result using alert, but I want to know if there is another method to print showVariable
's result in my html document.