Quiz Home
Javascript Quiz
1: What is the purpose of JavaScript?
  To style web pages
  To provide interactivity on websites
  To create databases



2: How do you declare a variable in JavaScript?
  var myVar
  variable myVar
  let myVar
  int myVar;



3: What does DOM stand for in the context of web development?
  Document Object Model
  Data Object Model
  Dynamic Object Model



4: How do you comment out a single line in JavaScript?
  // This is a comment
  /* This is a comment */
  # This is a comment
  -- This is a comment



5: Which operator is used to compare two values in JavaScript?
  =
  !=
  <=
  ++



6: What is an array in JavaScript?
  A collection of objects
  A list of strings
  A data structure that holds multiple values



7: How do you define a function in JavaScript?
  function myFunction() {}
  def myFunction(): {}
  method myFunction() {}
  def function myFunction() {};



8: What is the purpose of the alert() function in JavaScript?
  To display a message box with a message
  To declare a variable
  To define a function
  To perform mathematical operations



9: What is the use of the for loop in JavaScript?
  To create conditional statements
  To define functions
  To iterate over a block of code multiple times
  To style web pages



10: How do you select an HTML element by its ID using JavaScript?
  document.getElementByID()
  getElement()
  selectElementByID()
  querySelector();