Object Flashcards

(8 cards)

1
Q

How many data types are there in JavaScript?

A

Eight

Seven of these data types are called primitive.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What are primitive data types in JavaScript?

A
  • String
  • Number
  • Boolean
  • Undefined
  • Null
  • Symbol
  • BigInt

Primitive data types contain only a single value.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What are objects used for in JavaScript?

A

To store keyed collections of various data and more complex entities

Objects penetrate almost every aspect of the JavaScript language.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can an object be created in JavaScript?

A
  • Using curly braces {…}
  • Using the object constructor syntax: let user = new Object();

The curly braces are commonly used for object literals.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is a property in the context of a JavaScript object?

A

A ‘key: value’ pair

The key is a string (property name), and the value can be anything.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does an empty object represent in JavaScript?

A

An ‘empty cabinet’

It can be created using either object constructor or object literal syntax.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Fill in the blank: An object can be created using ________ syntax.

A

object literal

This is commonly done using curly braces.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

True or false: A property in a JavaScript object has a key and a value.

A

TRUE

The key is also known as the name or identifier.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly