JavaScript Basics Flashcards

1
Q

What is JavaScript used for in websites?

A

To add interactivity and dynamic behaviour.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a variable in JavaScript?

A

A container for storing data (e.g. let name = “Alex”).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is an if statement?

A

A condition that runs code only if it’s true.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is a function in JavaScript?

A

A block of code that performs a task and can be reused.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

How do you get input from a user in JavaScript?

A

Using prompt() (e.g. let name = prompt(“Enter your name”)).

How well did you know this?
1
Not at all
2
3
4
5
Perfectly