View Single Post
Old 03-23-2004, 12:14 PM   #7
hot_pastrami
I am meaty
 
Join Date: Dec 2001
Location: Salt Lake City, UT
Posts: 1,119
Beginners, you may gloss over this reply if you like, we'll cover this stuff soon enough.

Quote:
Originally posted by Radar
Do you have to declare your variable types such as a string, a whole number etc?
Not in Javascript... in Javascript, a basic variable can contain a boolean, a character, a number, or a string. In more advanced languages, this distinction is necessary, but not in JS.

Quote:
Originally posted by Radar
In the example of madlibs code, what are the commands for input and output of strings such as the "get" command?
Javascript have a built-in function called prompt() which asks the user for a value, and returns it. That's how we'd retreive the words from the user. We can then print those back out to the browser with a document.write() command.

Quote:
Originally posted by Radar
Does a double equal sign == mean not equal to?
No... a double equal is the test operator... if (myNumber == 10). A single equal is the assignment operator... myNumber = 15; If you want to test for Not Equals, you use the != operator.

A post on Javascript operators will be coming up shortly.
__________________
Hot Pastrami!
hot_pastrami is offline   Reply With Quote