Jump to content

Variable Script Question


shreyaskudav
 Share

Recommended Posts

What does the RED script do?And there is no " " inside the brackets..?
it's referring to the variable of that name.it will write firstname - which contains "Hege", and hence document will write "Hege"i believe the correct jargon is, it's being referenced ?:)
Link to comment
Share on other sites

document.write() prints to the page, that's all. If it's called after the page has finished loading then the page will be cleared so it can start writing.You only need quotation marks when you're using a literal string. If you want to print the value of a variable you use the variable's name.

Link to comment
Share on other sites

In javascript, the keyword "var," helps to store data, so dat it can be use latter in the document.Var firstname= "Hege";this variable that have a name "firstname" holds the value "Hege"document.write(firstname); this is telling the "document" to use the method "write" to write the value of the word the variable (firstname) holds in the html doc.THE REASON THERE ARE NO QUOTATION MARKS ( " ), ITS BECAUSE WE WANT THE DOCUMENT TO WRITE WHAT IS INSIDE THE VARIABLE AND NOT TO WRITE JUST PLAIN TEXT.i started reading js 3days back and GOD has been GOOD to me!

Edited by O. Samuel
Link to comment
Share on other sites

In javascript, the keyword "var," helps to store data, so dat it can be use latter in the document.Var firstname= "name";holds the value "name"document.write(name); this is telling the document, to use the method "write" to write down the value of the word the variable holds.
that's not entirely correct. aside from wether or not you have to use var or whether one should be using document.write, to print out the value of firstname i.e. "name", would actually be done like this:
var firstname= "name";document.write(firstname);

Link to comment
Share on other sites

......i started reading js 3days back and GOD has been GOOD to me!
Amen to that !! :) And the admins here are Angels !!
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...