JavaScript Questions

0 votes, 0 avg
210

JavaScript Questions

1 / 15

1. How to stop an interval timer in Javascript?

2 / 15

2. Which property references the DOM object that dispatched an event?

3 / 15

3. Which JavaScript method is used to write into an alert box?

4 / 15

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

function solve(arr, rotations){
 if(rotations == 0) return arr;
 for(let i = 0; i < rotations; i++){
   let element = arr.pop();
   arr.unshift(element);
 }
 return arr;
}
// solve([44, 1, 22, 111], 5);

5 / 15

5.  Where is Client-side JavaScript code is embedded within HTML documents?

6 / 15

6. Which of the following is the correct output for the following JavaScript code:

var grade='Z';  
var result;  
switch(grade)  
{  
case 'A':  
        result+="10";  
case 'B':  
        result+=" 9";  
case 'C':  
        result+=" 8";  
default:  
        result+=" 100";  
}  
document.write(result);  

7 / 15

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

8 / 15

8. JavaScript code can be written in ____.

9 / 15

9.

Which one of the following is correct output for the following given JavaScript code if there is a p tag with id=demo ?
functionourFunction()
{
document.getElementById("demo").innerHTML=Math.abs(-7.25);
}

10 / 15

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

 print(typeof(NaN)); 

11 / 15

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

const prototype1 = {};  
const object1 = Object.create(prototype1);  
console.log(Object.getPrototypeOf(object1) === prototype1);

12 / 15

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

13 / 15

13. How does forEach() method differ from a for statement?

14 / 15

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

15 / 15

15. in javascript "===" operator defines what?