Lesson 13: Variables (computer science notes/review)

0.0(0)
studied byStudied by 0 people
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/18

flashcard set

Earn XP

Description and Tags

computer science notes/review

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

19 Terms

1
New cards

variable definition

named container for storing data

2
New cards

____ is stored in RAM, so it is volatile

variable

3
New cards

variable is stored in _____, so it is volatile

RAM

4
New cards

Variable is used to store info to be _____/______

referenced/manipulated

5
New cards

____ make code reusable/dynamic

variable

6
New cards

How do you do camelCase?

1st var letter lowercase

2nd var word uppercase

7
New cards

Variables cannot start with a _____ or _______.

number ; special character

8
New cards

Why should names be descriptive & consistent?

so you & other ppl understand it

9
New cards

Use ‘let’ when ___________.

variables can be reassigned

10
New cards

use ‘const’ when _______

variables CANNOT be reassigned

11
New cards

Avoid using var because its _____ and ______

function-scoped; older

12
New cards

Global scope definition

access anywhere in code

13
New cards

Avoid ___ Scope for functions

Global Scope

14
New cards

What are cons of Global Scope?

wide use—> forget what code does —> bugs

15
New cards

Local Scope definition

declared inside functions/blocks

16
New cards

Block Scope definition

declare variable within blocks/functions

17
New cards

RW: What keyword should you use to declare a variable that can be changed?

‘let’ keyword

18
New cards

RW: True or False: The following variable name is valid in JS: 6shooter

False; invalid b/c begins with # instead of letter

19
New cards

RW: True or False: A “const” variable must be initialized when declared.

True; you have to give it a value right away or it wont work