JV D Q
JV D Q
In JavaScript, type casting is not necessary to convert one data type to another
data type. That means the variable containing numeric data can also contain
string data without any cast and no need to declare variable data type. For these
reason JavaScript is called loosely/weakly type language.
Undefined value means a variable has been declared but has not yet been
assigned a value.
Boolean values, numbers, strings, and the null and undefined values all constitute
primitive data types. Primitives are stored in a fixed chunk of memory, depending
on the type of primitive data. Primitives have a finite and known amount of space
in memory.
6. What is variable? A variable is a name that contains value that can change,
depending on conditions or on information passed to the program. A variable can
contain different type of data types such as Boolean values, numbers, strings etc.
var i =0;
Global variables are accessible from anywhere in the program and retain their
values until the document is unloaded.
Local variables, on the other hand, are created during function calls for
temporary use and are accessible only within the functions that create them.
A compound structure is simply a structure that uses two or more of the three
basic structures. For example:-
Do/while loop.
Do{
Statement
}While(termination condition) //Condition check here
1. start value
2. termination condition
3. increment/Decrement
AnsReturn statement is used to exit from the function and return value from the
function to the caller.
The function ()constructor looks like the new object or array constructor.
Var variable name=new Function("exp1"," exp2"," return exp3")
Function literals look more like function statements in that they use curly braces,
they have no unique of name of their own for purposes of reference.
var variable name=new Function()(arg1,arg2){return ex1};
Window (object)
Document (property of window)
Form (property of document)
Element (property of form)
Element value property of element)
Ans: Window>Document>Form>Element>Element Value.
23. What do you understand by proto type concept in JavaScript?
The Document Object Model (DOM) is the model that describes how all elements
in an HTML page, like input fields, images, paragraphs etc., are related to the
topmost structure: the document itself. By calling the element by its proper DOM
name, we can influence it.
Open Method: It is used to open a new window. The parameters of open method
are height, location, menubar, resizable, scrollbars, status, toolbars and width.
We can use as many or few of these options as we want.
Close Method: It is used to close any open window. It is always self-referent with
a page not part of a frameset.
The three cross browser methods of history objects are- back(), forward() and
go().
Back() It used to go the previously visited site.
forward() It is used to go the recently visited sites.
Go() It uses positive values and negative values both for forward and backward
references.
30. What are the two methods of location objects?The two methods of location
object are reload () and replace ().
Reload() is used for adding a new location removes the previous one.
Replace() is used for adding a location replacing the previous one.
Ans: JavaScript The most common use of the history object is to move back and
forth in a site .
Properties:
current - The current document URL.
next- The URL of the next document in the history object.
Previous- The URL of the last document in the history object.
Methods:
back() - Go to the previous URL entry in the history list.
setTimeout( ) method works the same as setInterval( ), except that it does not
repeat the script.
Ans: "with" statement is used when more function of an object is used .Using
with(), it is possible to reduce object references and make the code more
readable.
Syntax:with(object)
{
// Calling the functions of the object
}