Introduction to JavaScript Flashcards
What does client-side scripting mean?
Provides a way to dynamically modify the HTML content and appearance in the browser without having to contact the web server.
What is JavaScript?
A lightweight programming language that is used to make web pages more interactive.
How do you link a JavaScript file?
Using the tag and placing it in the head section of the HTML document.
What is event-driven programming?
Writing programs driven by user events. JavaScript programs wait for the browser or users action and respond to them.
What are the steps to make a responsive UI control?
- Choose the control (e.g. button) and event (e.g. mouse click) of interest
- Write a JavaScript function to run when the event occurs
- attach the function to the event on the control
What does alert(“…”) do?
A JS command that pops up a dialogue box with a message.
What is an event handler?
A routine that is used to deal with the event, allowing a programmer to write code that will be executed when the event occurs.
How do you write comments in JavaScript?
/* … */ and //
What are variables and how are they defined?
Variables are used to store and retrieve data. They are defined by using the keyword var.
What are the rules for variable names?
- The first letter must be a letter or an underscore with the rest being any letter, number, or underscore
- Variable names are case sensitive
- Words the are reserved by JavaScript cannot be used
What are the different JS data types?
Number, string, boolean, array, objects, function
What are the different number types?
Whole numbers and numbers with decimal places (floats)
What is an expression?
The combination of one or more variables, values, operators, or functions that computes a result.
What does it mean when strings are treated like characters?
It means that each character is treated as a single vaule and not as a combination of characters.
What does .length do?
Returns the number of characters in the strings