JavaScript Questions

0 votes, 0 avg
647

JavaScript Questions

1 / 15

1. Any time you include javascript variable in HTML document, you must enclose those lines inside a _______

2 / 15

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

3 / 15

3. What will be the result or type of error if p is not defined in the following JavaScript code snippet?

console.log(p)

4 / 15

4. Which collection object allows unique value to be inserted only once?

5 / 15

5. 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;
}

6 / 15

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

var arr = [7, 5, 9, 1];  
var min = Math.min.apply(null, arr);  
document.writeln(min);

7 / 15

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


var a = "Scaler";
var result = a.substring(2, 4);
document.write(result);

8 / 15

8. How to stop an interval timer in Javascript?

9 / 15

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

a = [1, 2, 3, 4, 5];
print(a.slice(2, 4));

10 / 15

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

11 / 15

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

12 / 15

12. 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);  

13 / 15

13.  If A is the superclass and B is the subclass, then subclass inheriting the superclass can be represented as _________

14 / 15

14. Which is the correct syntax for the function definition?

15 / 15

15. In JavaScript, what is a block of statement?

Your score is

0%

Written by Shubhranshu Shekhar, who has trained 20000+ students in coding.

Scroll to Top