Variables - var, let & const

Variables - var, let & const

Assessment

Interactive Video

Information Technology (IT), Architecture

University

Hard

Created by

Quizizz Content

FREE Resource

This video tutorial covers the basics of variable declaration in JavaScript, focusing on the use of VAR, let, and const. It explains how to create, reassign, and initialize variables, and discusses naming conventions. The tutorial also highlights the differences between let and const, particularly in terms of block scope, and clarifies common misconceptions about using const with arrays and objects.

Read more

10 questions

Show all answers

1.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which keyword was introduced in ES6 for variable declaration?

float

int

let

var

2.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the initial value of a variable declared with var but not assigned?

empty string

null

0

undefined

3.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is a common use case for initializing a variable without a value?

To use in a conditional statement

To declare a function

To create a constant

To start a loop

4.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which character is not allowed at the start of a JavaScript variable name?

Number

Underscore

Dollar sign

Letter

5.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

What is the recommended naming convention for multi-word variables in JavaScript?

lowercase

snake_case

PascalCase

camelCase

6.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

Which of the following is a valid variable name in JavaScript?

name!

$name

_name

1name

7.

MULTIPLE CHOICE QUESTION

30 sec • 1 pt

How does let differ from var in terms of scope?

let is function-scoped

let is block-scoped

let is globally-scoped

let has no scope

Create a free account and access millions of resources

Create resources
Host any resource
Get auto-graded reports
or continue with
Microsoft
Apple
Others
By signing up, you agree to our Terms of Service & Privacy Policy
Already have an account?