Which of the following is a correct way to declare a variable in JavaScript?

JavaScript Day 2

Quiz
•
Other
•
University
•
Hard
Abdul Roshan
Used 2+ times
FREE Resource
10 questions
Show all answers
1.
MULTIPLE SELECT QUESTION
45 sec • 1 pt
variable name = 'John';
let name = 'John';
const name = 'John';
var name 'John';
2.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following is not a primitive data type in JavaScript?
Number
String
Object
Boolean
3.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What is the result of the following expression: '5' + 3?
8
53
35
None
4.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
var x = 10;
if (true) {
var x = 20;
}
console.log(x);
10
20
Undefined
Null
5.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
What will be the output of the following code?
let y = 10;
if (true) {
let y = 20;
}
console.log(y);
10
20
Error
Undefined
6.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which method is used to convert all the lowercase letters in a string to uppercase in JavaScript?
toLowerCase()
toUpperCase()
capitalize()
uppercase()
7.
MULTIPLE CHOICE QUESTION
30 sec • 1 pt
Which of the following declarations will result in an error if the variable is reassigned or redeclared?
var name = 'John';
let name = 'John';
const name = 'John';
var name;
name = 'John';
Create a free account and access millions of resources
Similar Resources on Quizizz
14 questions
[Quiz 4] JavaScript string

Quiz
•
University
15 questions
test

Quiz
•
University
10 questions
Gold Batch Quiz -4

Quiz
•
University
10 questions
WEB Dasar

Quiz
•
1st Grade - University
10 questions
IoT และโหนด -Red

Quiz
•
University - Professi...
15 questions
METHODOLOGIES

Quiz
•
University
13 questions
BK English - Speakout Starter, Unit 2, review

Quiz
•
KG - University
10 questions
UNIT 1- MIDS

Quiz
•
University
Popular Resources on Quizizz
15 questions
Character Analysis

Quiz
•
4th Grade
17 questions
Chapter 12 - Doing the Right Thing

Quiz
•
9th - 12th Grade
10 questions
American Flag

Quiz
•
1st - 2nd Grade
20 questions
Reading Comprehension

Quiz
•
5th Grade
30 questions
Linear Inequalities

Quiz
•
9th - 12th Grade
20 questions
Types of Credit

Quiz
•
9th - 12th Grade
18 questions
Full S.T.E.A.M. Ahead Summer Academy Pre-Test 24-25

Quiz
•
5th Grade
14 questions
Misplaced and Dangling Modifiers

Quiz
•
6th - 8th Grade