PDA

View Full Version : Checking the variable


djesuraj
07-09-2004, 12:47 PM
Is there anyway to check what is stored in javascript variable?

I know there are system.out.println for Java --- how about javascript?

As a novice use on this I have no idea where to even look for tutorials...so if you know any good ones let me know

agent002
07-09-2004, 01:06 PM
errr... you mean just a regular variable?? Of course you need to be able to get the value from it, what purpose does it otherwise serve :P

You define a variable like this...
var variableName = value;
The value may be a string, number, boolean, null value, or an object...
var sampleString = 'This is a string!';
var sampleNumber = 5;
var sampleBoolean = false;
var thisIsNull = null;
var dateObject = new Date();

You can get the value of a variable like this:
var firstVariable = 'This is a string!';
var anotherVariable = firstVariable; //copies firstVariable
var thirdVariable = firstVariable + ', ' + anotherVariable; //concanetates strings

djesuraj
07-09-2004, 01:18 PM
I realized my follow in transferring the variable...thank you.:D