Variables & Constants in JavaScript (OCR A-Level Computer Science): Flashcards

📚Flashcards
Variables & Constants in JavaScript
Sign up to keep revising.Create a free account to study more flashcards and track your progress.

Practise the cards

10 cards from this deck

Show

What do variables store in JavaScript?

Data values that can be used and modified

What are constants in JavaScript?

Fixed values that cannot be changed once set

Keyword to declare a variable (modern)

let

Keyword to declare a constant

const

Old keyword to declare variables

var

Example data types in JavaScript

numbers, strings, booleans

Can a const be reassigned?

No, constants cannot be reassigned

Problem with var scope

Function scope can lead to unexpected results

When to use let

For variables that change

When to use const

For values that don't change

Explore OCR A-Level Computer Science Revision Notes by Topics

Explore OCR A-Level Computer Science Model Answers by Topics

Explore OCR A-Level Computer Science Quizzes by Topics

Explore OCR A-Level Computer Science Exam Questions by Topics

Join 100,000+ A-Level students studying Flashcards with us.

Select your subjects, and get access to A+ resources today.