Skip to main content

Menu

Home Quizzes Categories Current Affairs GK AI ToolsNEW Play Live Contact

JavaScript Quiz

Check your understanding of JavaScript from basic syntax to the concepts used in modern web applications.

30 Questions
30 min Duration
50% To pass
1.00 Marks / correct

Instructions

  • This quiz has 30 questions.
  • Questions are picked at random from a bank of 99, so each attempt is different.
  • You have 30 minutes. The quiz submits automatically when time runs out.
  • You need 50% to pass.
  • There is no negative marking.
  • You can mark questions for review and return to them before submitting.
  • Correct answers and explanations are shown after you submit.

Sample Questions & Answers

A preview of 12 questions from this quiz, each with the correct answer and a written explanation. Attempt the full, timed quiz to be scored and earn XP.

  1. Question 1

    Which keyword declares a block-scoped variable that can be reassigned in JavaScript?

    • var
    • let Correct answer
    • const
    • static
    Explanation: The let keyword declares a block-scoped variable whose value can later be reassigned.
  2. Question 2

    Which keyword declares a block-scoped variable that cannot be reassigned?

    • var
    • let
    • const Correct answer
    • define
    Explanation: The const keyword creates a block-scoped binding that cannot be reassigned.
  3. Question 3

    Which operator checks both value and type equality in JavaScript?

    • ==
    • =
    • === Correct answer
    • !==
    Explanation: The strict equality operator === compares both the value and the type without coercion.
  4. Question 4

    Which method converts a JavaScript object into a JSON string?

    • JSON.parse()
    • JSON.stringify() Correct answer
    • JSON.object()
    • JSON.encode()
    Explanation: JSON.stringify() serializes a JavaScript value into a JSON-formatted string.
  5. Question 5

    Which method parses a JSON string into a JavaScript value?

    • JSON.parse() Correct answer
    • JSON.stringify()
    • JSON.decode()
    • JSON.toObject()
    Explanation: JSON.parse() converts valid JSON text into the corresponding JavaScript value.
  6. Question 6

    Which array method adds one or more elements to the end of an array?

    • shift()
    • unshift()
    • push() Correct answer
    • append()
    Explanation: The push() method adds elements to the end of an array and returns its new length.
  7. Question 7

    Which array method removes the last element from an array?

    • pop() Correct answer
    • shift()
    • removeLast()
    • spliceEnd()
    Explanation: The pop() method removes and returns the last element of an array.
  8. Question 8

    Which array method removes the first element from an array?

    • pop()
    • shift() Correct answer
    • unshift()
    • slice()
    Explanation: The shift() method removes and returns the first element of an array.
  9. Question 9

    Which array method adds elements to the beginning of an array?

    • push()
    • prepend()
    • unshift() Correct answer
    • shift()
    Explanation: The unshift() method adds one or more elements to the beginning of an array.
  10. Question 10

    What does typeof null return in JavaScript?

    • null
    • undefined
    • object Correct answer
    • boolean
    Explanation: Due to a historical behavior in JavaScript, typeof null returns the string object.
  11. Question 11

    What is the result of typeof undefined?

    • null
    • undefined Correct answer
    • void
    • object
    Explanation: The typeof operator returns the string undefined for the primitive value undefined.
  12. Question 12

    Which value represents a number that is not a valid numeric result?

    • Infinity
    • NaN Correct answer
    • null
    • undefined
    Explanation: NaN means Not-a-Number and represents an invalid or unrepresentable numeric result.

Login/Register to attempt the full quiz and earn XP.

Explore more: All Computer & Technology quizzes · JavaScript

JavaScript Practice

JavaScript is one of the core technologies used on the web. This quiz gives you a chance to revise language fundamentals and the concepts that frequently appear while learning front-end or full-stack development.

Frequently Asked Questions

Each attempt serves 30 questions, drawn at random from a bank of 99, with 30 minutes.

You need at least 50% to pass this quiz.

No, there is no negative marking on this quiz.

Yes. You can attempt this quiz again at any time, though first-attempt XP bonuses apply only once.

Sign in to attempt this quiz and earn XP.

Login to Start Create free account

Related Quizzes