2. Fundamentals Flashcards

1
Q

What is the term for a JS program?

A

Script

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

Give 2 working environments to run JS scripts

A

Browser

Node.js

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

Give a browser-specific command

A

Alert

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

How is JS code inserted into HTML doc?
Where should the code be inserted?
When is this best used?

A

script tag
Any part of the HTML doc
For very simple scripts only

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

What sort of environment is node.js?

How do you execute a script in node js?

A

Server-side

“node my.js”

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

What is the usual practice for more complex JS code?

3x

A

External script
Resides in a separate file
Attached to HTML using src attribute

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

What happens if a script tag has both an src attribute and code inside?
How would you include both internal and external scripts?
2x

A

Code inside the script tag is ignored

Separate script tags

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

Which two attributes are no longer required in modern JS?

2x

A

Type

Language

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

In older HTML docs why would the code within script tags be commented out?

A

Older browsers (15+ years ago) did not know how to process the script tag

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