JavaScript Questions

0 votes, 0 avg
558

JavaScript Questions

1 / 15

1. Which function is used to serialize an object into a JSON string in Javascript?

2 / 15

2. Why is this keyword is not preferred in javascript?

3 / 15

3. Among the given statements, which statement defines closures in JavaScript?

4 / 15

4. Which of the following is correct about JavaScript?

5 / 15

5. Which JavaScript method is used to access an HTML element by id?

6 / 15

6. Which object serves as the global object at the top of the scope chain?

7 / 15

7. Which object in Javascript doesn’t have a prototype?

8 / 15

8. What will be the output of the following JavaScript code?

function printArray(a) 
{
     var len = a.length, i = 0;
     if (len == 0)
        console.log("Empty Array");
     else 
     {
// do-while loop in javascript
         do 
         {
             console.log(a[i]);
         } while (++i < len);
     }
}

9 / 15

9. What will be the output of the following JavaScript code?

// Javascript code to compare the height
function height()
{ 
    var  height = 123.56;
    var type = (height>=190) ? "tall" : "short";
    return type;
}

10 / 15

10. What will be the output of the following code snippet?

(function(a){
 return (function(){
   console.log(a);
   a = 6;
 })()
})(21);

11 / 15

11. What is the use of the noscript tag in Javascript?

12 / 15

12. JavaScript code can be written in ____.

13 / 15

13. What does the ‘toLocateString()’ method do in JS?

14 / 15

14. Which is the correct syntax to call an external JavaScript file in the current HTML document?

15 / 15

15. Which of the following global variables is used to get parameters?

Your score is

0%