Edit in JSFiddle

var name = 'HongGilDong';
//document.write(name);
document.getElementById("result").innerHTML = name;
alert(name);
console.log(name);
<!doctype html>
<html>

  <body>
    <h2>Hello World</h2>
    <h3 id="result"></h3>
  </body>

</html>