What can javascript programs do?
Generation of HTML pages on-the-fly without accessing the Web server. The user can be given control over the browser like User input validation Simple computations can be performed on the client’s machine The user’s browser, OS, screen size, etc. can be detected Date and Time Handling.
What does the delete operator do?
The delete operator is used to delete all the variables and objects used in the program,but it does not delete variables declared with var keyword.
How to access an external javascript file that is stored externally and not embedded?
This can be achieved by using the following tag between head tags or between body tags.
<script src=”abc.js”></script>
where “abc.js” is the external javscript file to be accessed.
Can you have a DIV element nested inside a SPAN element?
It is a bad practice to have a DIV element nested inside a SPAN element. You can have a SPAN inside a DIV. The reason being the DIV is a block element and SPAN is an inline element. So, why would you want to have a block element inside an inline element? SPAN is a like sub tag, which applies styles for the specified content in-between the SPAN tag.
HTML Tags
There are two HTML tags:
Starting tag and Closing tag
For example:
<b> Hello Dear </b>
Here, <b> is starting tag and </b> is closing tag.
Here, <b> Hello Dear </b> completely treated as an element.
What datatypes are supported in Javascript?
Number, String, Undefined, null, Boolean
What is the difference between an alert box and a confirmation box?
An alert box displays only one button which is the OK button whereas the Confirm box displays two buttons namely OK and cancel.
What is the difference between undefined value and null value?
Undefined means a variable has been declared but has not yet been assigned a value. On the other hand, null is an assignment value. It can be assigned to a variable as a representation of no value.Also, undefined and null are two distinct types: undefined is a type itself (undefined) while null is an object.
Unassigned variables are initialized by JavaScript with a default value of undefined. JavaScript never sets a value to null. That must be done programmatically.
-
- Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
- typeof undefined variable or property returns undefined whereas
typeof null value returns object
How to set a HTML document’s background color?
Document.bgcolor property can be set to any appropriate color.
What does break and continue statements do?
Continue statement continues the current loop (if label not specified) in a new iteration whereas break statement exits the current loop.