JavaScript Questions

0 votes, 0 avg
611

JavaScript Questions

1 / 15

1. Which of the following is correct about JavaScript?

2 / 15

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

3 / 15

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

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. Upon encountering empty statements, what does the Javascript Interpreter do?

6 / 15

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

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. Which function is used to serialize an object into a JSON string in Javascript?

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. Which JavaScript method is used to write into an alert box?

11 / 15

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

12 / 15

12. Which function is used to clear the timer value?

13 / 15

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

console.log(p)

14 / 15

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

15 / 15

15. Which property is used to define the HTML content to an HTML element with a specific id?

Your score is

0%

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