Explore 100's Of Free Video Tutorials

Keep Learning, Keep Coding & Keep Sharing

Hello World script

Notes:

Hello World program in JavaScript :

First Java Script program using Notepad:
Step 1:
Open the Notepad editor

Step 2:
2a: Type the basic HTML document structure code

HTML script tag:
We embed Java Script code in the HTML document using script tag.
script tag is a paired tag can be placed anywhere in the document.

attribute of script tag:
type=”text/javascript” indicates whatever we write in between script tag is going to be Java Script code

2b: Write script tag within body section.
3b: In between script tag write document.write(“Hello World!”);

JavaScript : document.write(“Hello World!”);

document : is an in built object in JavaScript, which refers to HTML document
write(expression) : is a method available in document object, which is used to display output to the document
pair of brackets () : an identifier followed by pair of brackets indicates a function or method in JavaScript
dot(.) : is a member access operator, which is used to access member data or member methods
JavaScript string (“”) : a string is a sequence of characters enclosed in between double quotations
Semicolon(;) : Every JavaScript statement ends with a semicolon.

Step 3:
File == Save As == ”HelloWorld.html” ==Save.

Step 4:
Open in browser (Google Chrome is best).

Interview Questions:

1. JavaScript is ________________ language
a. scripting
b. query
c. database
d. markup
Answer: a

2. JavaScript is _____________ side scripting language
a. server
b. client
c. internet
d. network
Answer: b

3. JavaScript is ___________________ language
a. structural
b. presentation
c. behavioral
d. non of the above
Answer: c