JavaScript Questions

0 votes, 0 avg
575

JavaScript Questions

1 / 15

1. What is the prototype represents in the following JavaScript code snippet?

 function javascript() 
{};

2 / 15

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

const arr = [10, 20, 30];
 let result = 0;
 
 arr.forEach(myFunction);
 
 document.write("Result: " , result)
 function myFunction(value, index, array) {
   result += value; 
 }

3 / 15

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

4 / 15

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

5 / 15

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

const obj1 = {Name: "Hello", Age: 16};
const obj2 = {Name: "Hello", Age: 16};
print(obj1 === obj2);

6 / 15

6. When the switch statement matches the expression with the given labels, how is the comparison done?

7 / 15

7. How are windows, tabs, iframes, and frames treated according to client-side javascript?

8 / 15

8. What will be the output of the following JavaScript code If these is a p tag element with id=”demo”?

var numbers1 = [4, 9];
var numbers2 = numbers1.map(myFunction);
document.getElementById("demo").innerHTML = numbers2;
function myFunction(value, index, array)
{
return value * 2;
}

9 / 15

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

const curr = new Date();
 document.write(curr);

10 / 15

10. Which of the following is not considered as an error in javascript?

11 / 15

11. Which of the following is the correct way for writing Java Script array?

12 / 15

12. Which statement creates a new object using the Person constructor?

13 / 15

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

14 / 15

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

15 / 15

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

Your score is

0%