JavaScript Questions

0 votes, 0 avg
604

JavaScript Questions

1 / 15

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

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

2 / 15

2. Which of the following methods can be used to display data in some form using Javascript?

3 / 15

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

4 / 15

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


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

5 / 15

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

6 / 15

6. What is the main difference between var and let keywords in JavaScript?

7 / 15

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

8 / 15

8. What does the Javascript “debugger” statement do?

9 / 15

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

console.log(p)

10 / 15

10. Which of the following is a valid function to truncate number of full minutes between two time stamps?

11 / 15

11. Which of the following function of the String object returns the character in the string starting at the specified position via the specified number of characters?

12 / 15

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

13 / 15

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

14 / 15

14. Which of the following is correct about JavaScript?

15 / 15

15. how can you write into HTML output using javascript?

Your score is

0%