0
0
Javascriptprogramming~5 mins

Primitive data types in Javascript - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What are primitive data types in JavaScript?
Primitive data types are the most basic data types in JavaScript. They represent simple values and are not objects. Examples include string, number, boolean, null, undefined, symbol, and bigint.
Click to reveal answer
beginner
What is the difference between null and undefined?
null means a variable has been explicitly set to have no value. undefined means a variable has been declared but not assigned any value yet.
Click to reveal answer
beginner
Which primitive data type is used to represent true or false values?
The boolean data type represents logical values: true or false.
Click to reveal answer
intermediate
What is a symbol in JavaScript?
A symbol is a unique and immutable primitive value often used to create unique object property keys to avoid name conflicts.
Click to reveal answer
intermediate
How do you create a BigInt value in JavaScript?
You create a BigInt by appending n to the end of an integer literal, for example: 123n. BigInt is used for integers larger than the Number type can safely represent.
Click to reveal answer
Which of the following is NOT a primitive data type in JavaScript?
ABoolean
BString
CObject
DSymbol
What value does an uninitialized variable hold in JavaScript?
Aundefined
Bfalse
C0
Dnull
Which primitive type would you use to store the text 'Hello'?
AString
BNumber
CBoolean
DSymbol
How do you create a BigInt literal?
ABy calling BigInt() without arguments
BBy writing a number with a decimal point
CBy using quotes around a number
DBy appending 'n' to an integer
Which primitive type is used to represent a unique identifier?
ABoolean
BSymbol
CNull
DUndefined
Explain the main primitive data types in JavaScript and give a simple example of each.
Think about the simplest values you can store in variables.
You got /8 concepts.
    Describe the difference between null and undefined in JavaScript.
    Consider what happens when you declare a variable but don’t assign it.
    You got /3 concepts.