Tuesday, November 19, 2013

Javscript Interview Questions

1) How we can write java script on a web page?
A. There are 3 ways to write Java script on the webpage.Which are:
- Inline java script : we can call the java script functions with the tags.
- External java script : We can give reference to the external java script o the webpage
- On webpage : We can write <script></script> on the page and start writing our java script code

2) Is java script Case Sensitive?
A. Yes, java script is case sensitive scripting language


3) How many data-types in java script?
A. We have the following data types in java script:
- Boolean
- Object
- String
- Array
- Number
- Function
- NULL
- Undefined


4) Is Java script is automatic data conversion language?
A. Yes, java script can automatically detect the data and its type and convert to same.
Eg: var a = "hello"; // typeof(a) : String


5) What is the difference between "==" and "==="?
A. Although both are the comparison operators but former just compare the values in the Left/right side whereas later will also check the type and value of the comparison value.

Eg: var a = 11,
              b = "11";

(a == b) // true
(a === b) // false - as the one is number and other is string


6) How you create Array in java script?
A. var names = new Array();
names[0] = 'neha',
names[1] = 'naina'

Other way:

var names = new Array('neha','naina');

7) Index of Array starts from?
A. Zero (0)

8) What does "2" + 3+2 will give you output?
A. 232 // As the first character ('2') is string .i.e, the calculation will be string operation

9) What does 2 + 3 + "2"will give you output?
A. 52 (As the first two are integer hence the addition will take place and last one is string hence it will take concentation: 52)

10) What are jQuery and DOJO?
A. These are the frameworks of the java script . We can use either library and write the java script by using the library syntax.



No comments:

Post a Comment