31.What does javascript null mean?
The null value is a unique value representing no value or no object.
It implies no object,or null string,no valid boolean value,no number and no array object.
32.How do you create a new object in JavaScript?
var obj = new Object(); or var obj = {};
33.How do you assign object properties?
obj["age"] = 23 or obj.age = 23.
34.What’s a way to append a value to an array?
arr[arr.length] = value;
35.To set all checkboxes to true using JavaScript?
//select all input tags
function SelectAll() {
var checkboxes = document.getElementsByTagName("input");
for(i=0;i<checkboxes.length;i++) {
if(checkboxes.item(i).attributes["type"].value == "checkbox") {
checkboxes.item(i).checked = true;
}
}
}
36.What does undefined value mean in javascript?
Undefined value means the variable used in the code doesn't exist or is not assigned any value or the property doesn't exist.
37.What is the difference between undefined value and null value?
(i)Undefined value cannot be explicitly stated that is there is no keyword called undefined whereas null value has keyword called null
(ii)typeof undefined variable or property returns undefined whereas typeof null value returns object
38.What is variable typing in javascript?
It is perfectly legal to assign a number to a variable and then assign a string to the same variable as follows
example
i = 10;
i = "string";
This is called variable typing
39.Does javascript have the concept level scope?
No. JavaScript does not have block level scope, all the variables declared inside a function possess the same level of scope unlike c,c++,java.
40.What are undefined and undeclared variables?
Undeclared variables are those that are not declared in the program (do not exist at all),trying to read their values gives runtime error.But if undeclared variables are assigned then implicit declaration is done .
Undefined variables are those that are not assigned any value but are declared in the program.Trying to read such variables gives special value called undefined value.

No comments:
Post a Comment