Вы находитесь на странице: 1из 2

1. What is the difference between == and === ?

The == checks for value equality, but === checks for both type and value.

2. What does 1+2+4 evaluate to? What about 5 + 4 + 3?

Since 1 is a string, everything is a string, so the result is 124. In the second case, its 93.

3. What datatypes are supported in Javascript?

Number, String, Undefined, null, Boolean

4. How to make JavaScript function executing every second?

a. setInterval(myfunction, 1);
* b. setInterval(myfunction, 1000);
c. setTimeout(myfunction, 1);
d. setTimeout(myfunction, 1000);

5 Which of the following code is valid JavaScript code?

* a.
try {
throw "Error!";
} catch( error ) {
console.log( error );
}
b.
try {
throw new Exception("Error!");
} catch( Exception error ) {
console.log( error );
}
c.
try {
throw Exception("Error!");
} catch( error ) {
console.log( error );
}
d.
try {
new window.exception("Error!");
} catch( error ) {
console.log( error );
}
6 How to display a message box in JavaScript?

a. msg.alert(Hi);
* b. alert(Hi);
c. document.alert(Hi);
d. document.show.alert(Hi);
7 Which of following examples is correct example of function definition?

a. function:myFunction (){ }
* b. function myFunction(){ }
c. function = myFunction(){ }
d. none of above

8 How to access following element: <p id=myId></p> by its id?

a. window.browser.getElementById(myId);
b. javaScript.getElementById(myId);
c. document.getElement(myId);
* d. document.getElementById(myId);

9 What is difference between functions call and bind?

call attaches this into function and executes the function immediately
bind attaches this into function and it needs to be invoked separately

10 What is difference between GET and POST method?

GET and POST are two different types of HTTP requests. Essentially GET is used to retrieve remote data,
and POST is used to insert/update remote data.

(GET requests a representation of the specified resource. Note that GET should not be used for operations
that cause side-effects, such as using it for taking actions in web applications. One reason for this is that GET
may be used arbitrarily by robots or crawlers, which should not need to consider the side effects that a
request should cause.

POST submits data to be processed (e.g., from an HTML form) to the identified resource. The data is
included in the body of the request. This may result in the creation of a new resource or the updates of
existing resources or both.)

Вам также может понравиться