-1

All JavaScript Expert. I am just beginner to javascript. I have declared some variable and i wanted to view it on my browser but it is not showing. Here are my codes

<script>
var year=2014, month = 'Agust', day = "Friday";
document.write('I am showing something'.' year, month, day);
</script>

Please help me and descriptive as much as possible. I wanted to write some text with outputting the variable value.

Ruzina Bagum
  • 21
  • 1
  • 2

1 Answers1

0

There are good reasons to avoid document.write(), but it works well enough in this simple case, as you're learning your way around Javascript.

document.write() only takes 1 parameter, not a list. You'll either need to call it more than once, or concatenate those variables yourself:

document.write('I am showing something: ' + year + ", " + month + ", " + day);
Community
  • 1
  • 1
Paul Roub
  • 35,100
  • 27
  • 72
  • 83