We would like to know how to change undefined variable to empty string.
<!DOCTYPE html>
<html>
<head>
<script type='text/javascript'>
<!--from w ww.j a va2 s . co m-->
var i;
if (i==undefined){
i="";
}
document.writeln(typeof i);
</script>
</head>
<body>
</body>
</html>
The code above is rendered as follows: