HomePortalFAQSearchMemberlistUsergroupsRegisterLog in

Share | 

 JavaScript for beginners

Go down 
Excimer Sun Software

Excimer Sun Software

Posts : 152
Join date : 2010-05-07
Age : 26
Location : USA

PostSubject: JavaScript for beginners   Mon Aug 16, 2010 9:01 pm

Hello! ESS here! Today I'm writing a tutorial on how to make your first JavaScript program, a "Hello World!" script. First off, I'm going to show you the whole thing, then I'll explain it line-by line. Here's the entire script:

document.write("Hello World!");

Yep! It's that easy! Smile Now for the explanation:

document.write("Hello World!");
This is a built-in JavaScript method. This must begin with 'document' followed by a dot followed by 'write', after which must come an opening parenthesis, what you want to print, and then a closing parenthesis. The content of our parenthesis, "Hello World!", is a string. A string is a series of characters which is usually either taken as input or printed to a web document. Strings must be enclosed in either single or double quotes to be read properly. In our case, we want to say hello to the world, so we place, Hello World!, inside of quotes. If you leave quotes out, it will think that you are trying to print a variable and will complain about it if a variable of the same name as the text of the string hasn't already been defined. Also, at the end of the line, you will probably notice a semicolon. In JavaScript, every end of a line of code must be marked with a semicolon.

There you go! That wasn't too bad, was it? If anyone has any questions, comments, constructive criticism, or discrepancies to point out in the tutorial, please feel free to post below. Also, HTML hello world coming soon!

Back to top Go down
View user profile
JavaScript for beginners
Back to top 
Page 1 of 1
 Similar topics
» JavaScript Chess
» Programming A Chess Engine In Pure Javascript! (youtube)
» RUST's Beginners Guide & Tips and Tricks
» P4wn (new javascript chess engine)
» Neuer beginner Clan Apocalyptic Vendetta!

Permissions in this forum:You cannot reply to topics in this forum
Compile Crazy :: Web Developing :: For Beginners-
Jump to: