General - JavaScript basics Flashcards

1
Q

Q: What is type coercion in JavaScript?

A

A: Automatic conversion between types (e.g., “5” + 2 → “52”)

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

Q: Common JS variable types?

A

A: String, Number, Boolean, Undefined, Object

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

Q: Two common string methods in JS?

A

A: .length, .toUpperCase(), .substring()

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

Q: What does document.getElementById(“demo”) do?

A

A: Selects the element with id “demo” from the DOM.

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

Q: What’s a JavaScript event handler example for a button?

A

A: <button>Click Me</button>

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