My following javascript file displays nothing , although I was expecting a link there . Somebody please tell me the reason
<p id="demo"></p>
<script type="text/javascript">
var u = 'somewebsite';
var q += '<a href="'+u+'">';
var q += '</a>';
document.getElementById("demo").innerHTML=q;
</script>
several things going wrong here. First, as shelman says, q isn’t being initialised. Secondly using var is redefining the variable. And thirdly, your link has no content: