Intro to JavaScript

1. What is JavaScript?
JavaScript is a Scripting language, a scripting language is a lightweight programming language. JavaScript is a programming code that can be inserted into HTML pages.JavaScript inserted into HTML pages, can be ignored by all modern web browsers.

2. What company started JavaScript?
Netscape Communications Corporation, and Mozilla Foundation.

3. Explain briefly the main difference of Java and JavaScript.
First of all, the JavaScript programming language, developed by Netscape, Inc., is not part of the Java platform.Here are some of the key differences: Java is an OOP programming language while Java Script is an OOP scripting language. Java creates applications that run in a virtual machine or browser while JavaScript code is run on a browser only. Java code needs to be compiled while JavaScript code are all in text. They require different plug-ins.

4. What are the things can we do to a webpage using JavaScript?
It can be set to execute when something happens on the website, like when a page has finished loading or when a user clicks on a button.

5. Where do we write JavaScript codes? On which programs/applications?
You can put it on a HTML, you can place your code in either the head section, or the body section of your HTML page. Programs such as Notepad ++, Adobe Dreamweaver will work.

6. How can we see the result of our JavaScript code?
By opening a browser.

7. What is the HTML tag to start a JavaScript code?
It is: script type=”text/javascript” This is the HTML tag to start a Javascript code.

8. What is a variable? How is it different to a value?
Variable is a storage location and an associated symbolic name (an identifier) which contains some known or unknown quantity or information, which is the value. THe difference is that variable is the storage. and value is the quantity of information that the variable contains.

9. What are the data types in JavaScript?
It is String, Number, Boolean, Array, Object, Null, and Undefined.

10. How do we write comments in JavaScript?
Comments will not be executed by JavaScript.Comments can be added to explain the JavaScript, or to make the code more readable. Single line comments start with //. Below is an example:
// Write to a heading:
document.getElementById(“myH1″).innerHTML=”Welcome to my Homepage”;
// Write to a paragraph:
document.getElementById(“myP”).innerHTML=”This is my first paragraph.”;