Koenig Course for JavaScript and jQuery Quiz Questions and Answers

Which was the first browser to support JavaScript?

Answer :
  • Netscape

JavaScript is ________ language.

Answer :
  • an interpreted

Predict the output on the console for the following JavaScript code. < script > function showNumber { if(true) { var a = 5; } document.write(a); } showNumber(); < /script >

Answer :
  • 5

Which function of an Array object calls a function for each element in the array?

Answer :
  • forEach()

Predict the output on the console for the following JavaScript code. < script > let companyName = 'Koenig'; console.log(typeof companyName); numberOfEmployee=1; console.log(typeof numberOfEmployee); < /script >

Answer :
  • string,number

Which of the following is the correct syntax to display “Koenig” in an alert box using JavaScript?

Answer :
  • alert(“Koenig”);

What is the syntax for creating a function in JavaScript named Showfunc?

Answer :
  • function Showfunc()

What is the correct jQuery code to set the background color of all p elements to red?

Answer :
  • $( "p ").css( "background-color ", "red ");

When referencing an HTML element preceded by a # (pound or hash), what javascript function is this equivalent to?

Answer :
  • getElementById

Which function do you reference in HTML form data?

Answer :
  • val()