JavaScript

JavaScript

Test your JavaScript knowledge with free quizzes on MyCodeSkills covering core concepts.


  1. What does JavaScript primarily run on?

    • A. Web Server
    • B. Browser
    • C. Database
    • D. Operating System
  2. Which keyword is used to declare a variable in JavaScript?

    • A. var
    • B. dim
    • C. let
    • D. Both A and C
  3. Which of the following is NOT a JavaScript data type?

    • A. String
    • B. Number
    • C. Boolean
    • D. Character
  4. How do you write a comment in JavaScript?

    • A. <!-- comment -->
    • B. // comment
    • C. /* comment */
    • D. Both B and C
  5. Which symbol is used for strict equality in JavaScript?

    • A. =
    • B. ==
    • C. ===
    • D. !=
  6. Which of these is a new variable declaration keyword introduced in ES6?

    • A. var
    • B. let
    • C. const
    • D. Both B and C
  7. Which ES6 feature allows destructuring arrays and objects?

    • A. Spreading
    • B. Template literals
    • C. Destructuring assignment
    • D. Arrow functions
  8. How do you write an arrow function?

    • A. function => {}
    • B. () => {}
    • C. => () {}
    • D. () -> {}
  9. What is the purpose of `Promise` in JavaScript?

    • A. Handle synchronous tasks
    • B. Handle asynchronous tasks
    • C. Handle CSS animations
    • D. Handle JSON
  10. Which method is used to handle resolved promises?

    • A. .catch()
    • B. .then()
    • C. .finally()
    • D. .resolve()
  11. What is a closure in JavaScript?

    • A. Function inside a loop
    • B. Function with access to outer scope
    • C. Blocked code
    • D. Unused variable
  12. Which method changes the prototype of an object?

    • A. Object.assign()
    • B. Object.setPrototypeOf()
    • C. Object.create()
    • D. Object.defineProperty()
  13. What is the value of `this` in strict mode when called in a function?

    • A. window
    • B. undefined
    • C. null
    • D. global
  14. Which design pattern ensures only one instance of a class?

    • A. Factory
    • B. Singleton
    • C. Observer
    • D. Prototype
  15. Which method creates a deep clone of an object?

    • A. Object.assign()
    • B. JSON.parse(JSON.stringify())
    • C. clone()
    • D. deepCopy()