JavaScript Quiz Questions

DeadCheapErbium avatar
DeadCheapErbium
·
·
Download

Start Quiz

Study Flashcards

20 Questions

What does the 'Promise' object in JavaScript primarily do?

To handle asynchronous operations and their results

Which method is used to add a new element at the beginning of an array in JavaScript?

unshift()

What is the main functionality of the 'localStorage' object in JavaScript?

Store data locally within the user's browser

What is the purpose of the 'fetch' API in JavaScript?

To make HTTP requests and handle responses asynchronously

What does the 'typeof' operator do in JavaScript?

Returns the type of a variable or expression

How can you add a new element to the end of an array in JavaScript?

array.push()

What is the result of '5' + 3 in JavaScript?

'53'

Which method is used to remove the last element from an array in JavaScript?

array.pop()

What will be the result of the division 10 / '2' in JavaScript?

5

What is the output of typeof null in JavaScript?

'object'

Which comparison below would return false in JavaScript?

'5' === 5

What happens when you use the 'delete' operator on a variable declared with var in JavaScript?

The variable becomes undefined

What does the 'charAt' method in JavaScript do?

Returns the character at a specified index in the string

How can you determine if a string contains a specific substring in JavaScript?

By using the 'indexOf' method

What is the purpose of the 'instanceof' operator in JavaScript?

To check if a variable is an array

What is the output of 1 + 2 + '3' in JavaScript?

'123'

What is the purpose of the "toLocaleString" method in JavaScript?

To format a date according to the system's locale

How do you convert a string to a date object in JavaScript?

new Date(string)

What does the 'charAt' method do in JavaScript strings?

Selects the first character of the string

What is the output of 3 > 2 > 1 in JavaScript?

true

Study Notes

JavaScript Fundamentals

  • The 'Promise' object in JavaScript is used to handle asynchronous operations, allowing you to write asynchronous code that is easier to read and maintain.

Array Methods

  • The unshift() method is used to add a new element at the beginning of an array in JavaScript.
  • The push() method is used to add a new element to the end of an array in JavaScript.
  • The pop() method is used to remove the last element from an array in JavaScript.

Storage

  • The 'localStorage' object in JavaScript is used to store data locally within the user's browser, allowing web applications to store and retrieve data even after the browser has been closed.

APIs and Networking

  • The 'fetch' API in JavaScript is used to make HTTP requests and interact with servers, allowing web applications to retrieve and send data.

Operators and Data Types

  • The 'typeof' operator in JavaScript is used to determine the data type of a variable or value, returning a string indicating the type of the operand.
  • The + operator in JavaScript performs string concatenation when one of the operands is a string.
  • The / operator in JavaScript performs arithmetic division, and converts the operands to numbers if necessary.

Strings

  • The 'charAt' method in JavaScript is used to retrieve a character at a specific position in a string, with indexing starting from 0.
  • The indexOf() method in JavaScript is used to determine if a string contains a specific substring, returning the index of the substring if found, or -1 otherwise.

Variables and Operators

  • The 'instanceof' operator in JavaScript is used to test whether an object is an instance of a particular constructor or prototype.
  • The delete operator in JavaScript is used to remove a property from an object, but has no effect on variables declared with var.

Dates and Localization

  • The "toLocaleString" method in JavaScript is used to convert a date object to a string, using the browser's locale and language settings.
  • The Date constructor in JavaScript can be used to convert a string to a date object, by parsing the string in a browser-dependent manner.

Test your knowledge of JavaScript with these quiz questions covering topics like division by zero, the 'with' statement, and string manipulation methods. Choose the correct answers and see how well you know JavaScript!

Make Your Own Quizzes and Flashcards

Convert your notes into interactive study material.

Get started for free
Use Quizgecko on...
Browser
Browser