1. What is JavaScript?
JavaScript is a client-side as well as server side scripting language. JavaScript is also an Object based Programming language.
2. What are JavaScript types?
Null
Undefined
Boolean
Number
String
Object
3. What is Difference between = = and = = = ?
= = Operator check the equality of value on both side.
= = = Operator check the equality of value both side as well as its type too.
4. How do you access object property?
By using dot . operator
5. What is hoisting ?
Suppose If developer forgot to declare a variable and he/she directly try to use it then java script engine declare it one level up. So the leveled up variable will become a global.
Lifting variable declaration one level up is called hoisting.
The below example can explain clearly.
The above example will not any error because It will make var name(global) internally.
6. What is callback function ?
Callback function is a function which is passed to another function as a parameter and callback function is called inside the other function.
It also known as a higher-order function.
See the below example.
7. What is this keyword ?
Just its expressing context of current object. By using "this" you can access the current object.
8. What are the types of functions available in java script ?
1. Named Function
2. Anonymous Function
3. Self-invoking Function
9. Give me an example for Named function ?
A function with a name is called named function.
example below,
10. What is isNaN function in java script?
If the specified argument is not a number then it will return true otherwise it is false.
11. How can you submit a form in java script?
Use the below code to submit a form.
Note : form[0] mentioned order of form number.
12. What is an undefined?
Undefined may exists by following the below scenario,
1. You are using variable and Its not exist in the code.
2. Property itself not exist
3. Variable is not assigned properly(means no value assigned).
13. Break and continue statements difference?
Break - It exits from the current loop.
Continue - It continues to the next iteration of the loop.
14. What is self invoking function ?
Self invoking function is a function which can run by itself when encountered and we no need to call.
Below is without arguments,
Below is passing arguments,
15. What is anonymous function ?
Anonymous function a function which do not have any name.
Note: Don't confuse here, just we are assigning to variable called test. But function not having any name.
JavaScript is a client-side as well as server side scripting language. JavaScript is also an Object based Programming language.
2. What are JavaScript types?
Null
Undefined
Boolean
Number
String
Object
3. What is Difference between = = and = = = ?
= = Operator check the equality of value on both side.
= = = Operator check the equality of value both side as well as its type too.
var num = 1; var str = "1"; console.log(num == str); //Output: TRUE
var num = 1; var str = "1"; console.log(num === str); //Output: FALSE
4. How do you access object property?
By using dot . operator
var obj1 = {name: 'Test'}; obj1.name; //Output: Test
5. What is hoisting ?
Suppose If developer forgot to declare a variable and he/she directly try to use it then java script engine declare it one level up. So the leveled up variable will become a global.
Lifting variable declaration one level up is called hoisting.
The below example can explain clearly.
function person(){ name = 'john'; //Directly using without declaring }
The above example will not any error because It will make var name(global) internally.
6. What is callback function ?
Callback function is a function which is passed to another function as a parameter and callback function is called inside the other function.
It also known as a higher-order function.
See the below example.
function doTest(test, callback) { alert('Checking ${test}'); callback(); } doTest('test', function() { alert('Finished...'); });
7. What is this keyword ?
Just its expressing context of current object. By using "this" you can access the current object.
8. What are the types of functions available in java script ?
1. Named Function
2. Anonymous Function
3. Self-invoking Function
9. Give me an example for Named function ?
A function with a name is called named function.
example below,
function person(){ //Some code here }
10. What is isNaN function in java script?
If the specified argument is not a number then it will return true otherwise it is false.
11. How can you submit a form in java script?
Use the below code to submit a form.
document.form[0].submit();
Note : form[0] mentioned order of form number.
12. What is an undefined?
Undefined may exists by following the below scenario,
1. You are using variable and Its not exist in the code.
2. Property itself not exist
3. Variable is not assigned properly(means no value assigned).
13. Break and continue statements difference?
Break - It exits from the current loop.
Continue - It continues to the next iteration of the loop.
14. What is self invoking function ?
Self invoking function is a function which can run by itself when encountered and we no need to call.
Below is without arguments,
(function(){ alert("test"); })();
Below is passing arguments,
(function(name){ alert(name); })("test");
15. What is anonymous function ?
Anonymous function a function which do not have any name.
var test = function(){ //some code here }
Note: Don't confuse here, just we are assigning to variable called test. But function not having any name.
No comments:
Post a Comment