2. Fundamentals Flashcards
What is the term for a JS program?
Script
Give 2 working environments to run JS scripts
Browser
Node.js
Give a browser-specific command
Alert
How is JS code inserted into HTML doc?
Where should the code be inserted?
When is this best used?
script tag
Any part of the HTML doc
For very simple scripts only
What sort of environment is node.js?
How do you execute a script in node js?
Server-side
“node my.js”
What is the usual practice for more complex JS code?
3x
External script
Resides in a separate file
Attached to HTML using src attribute
What happens if a script tag has both an src attribute and code inside?
How would you include both internal and external scripts?
2x
Code inside the script tag is ignored
Separate script tags
Which two attributes are no longer required in modern JS?
2x
Type
Language
In older HTML docs why would the code within script tags be commented out?
Older browsers (15+ years ago) did not know how to process the script tag