Unit 1 Flashcards
How To: Open a box that says Hello, world!
alert (“Hello,world.”);
What Are The Steps in Program Development?
- Define the problem
- Outline the solution
- Develop the outline into an algorithm
- Test the algorithm for correctness
- Code the algorithm into a specific programing language working in “versions”
- Run the latest “version” of the program on the computer
- Document and maintain the program
How do you define the problem?
- Input variable list
- processing checklist
- output variable list
How do you Outline the Solution?
- the major processing steps
- the major subtasks
- the user interface
- the major control structures
- the major variables and record structures
- the mainline logic
What is the unit of indentation for JavaScript?
Four Spaces
If a line of code is too long to fit on one line of the text editor, what unit of indentation must the continuation of the line be?
Eight Spaces
What is the maximum number of characters to use on a JavaScript line?
80 Characters
What are the comments that we need to use in this class?
- Our Name, Section and email at the top of our labs.
- A comment line at the start of each section within a program. These section comment lines must start with a verb. (Describing an action)
What are Semicolons used for in JavaScript?
To terminate a statement.
var firstName="Fred"; document.write(firstName);
Every Simple Statement must end with a semicolon, true or false?
True
Every simple statement must be on its own line, true or false?
True
When should you use blank lines?
- After each section of your program.
- Most operators must have a space above and below
- A space should follow every comma “,”
// Operator spacing
var firstName = "Fred"; var errorCount = 0;
errorCount += 3; enteredNumbersSum = numberOne + numberTwo;
// Note: The three exceptions to this rule are for the dot "." , // the "++", and the "--" operators.
loopCounter++; // no space around the ++ loopCounter--; // no space around the -- document.write("Hi Parent"); // no space around the dot
What is JavaScript?
- JavaScript is an interpreted programing language.
2. There is a full computer program inside each browser that reads your JavaScript code and runs the code.
What is an “Interpreter”?
The full program within each browser that reads and runs the JavaScript code.
What are the three rules that we are concerned with in this class?
- Syntax
- Convention
- Style
What is the rule of syntax?
If a computer programing language enforces a rule then we call that rule “syntax”. This is the strongest level of rule. If you break this rule, the program will not run.
What rule is this?
If a computer programing language enforces a rule, this is the strongest level of rule. If you break this rule, the program will not run.
The rule of Syntax.
What is the rule of Convention?
If most users of a programing language all over the world do something the exact same way, it is called a “Convention”. Although the JavaScript language itself doesn’t care about these rules, if everyone is using them, there is a good reason for it. A professional follows convention.
What rule is this?
Something that users all over the world do the same. Although the JavaScript language does not care, there is usually a good reason for this and a professional will follow it.
The rule of Convention.
What is the rule of Style?
There are many ways of structuring your code. The main thing is that you pick a method and stick with it. Be consistent.
What rule is this?
There are many ways of structuring your code. The main thing is that you pick a method and stick with it. Be consistent.
The rule of Style.
Is JavaScript case sensitive?
yes.
True or False
JavaScript is not case sensitive.
False. JavaScript is case sensitive.
What is White Space in JavaScript?
- Space
- Tab
- Carriage Return (officially called the “line terminator”
What does RAM stand for?
Random Access Memory
What Three things do computers do from our perspective?
- They get data into the program
- They process the data
- They output the data
What is RAM, Random Access Memory?
RAM is one long linear chain of bits. And a bit is a very simple thing, it’s just a 0 or a 1.
Think of each mark on the tape measure as a single bit.
Data is just a collection of bits in a known spot.
Say, starting at 5” on the tape measure and going for 10 marks.
What is a variable?
Data within a program is stored in variables. From a software perspective, a variable is a container that holds references to data.
What is a container that holds references to data.
A Variable
How many types of JavaScript statement are there?
2 types of JavaScript statements.
- A simple Statement
- A compound statement
What is a simple JavaScript statement?
A simple statement is simple:
x = 4;
What is a compound statement?
A compound statement combines multiple levels of logic. An if/the/else conditional is a good example:
if (something == 1) { //Some Code Here } else { //Some other code here }
Triue or False, there are five JavaScript statement types.
False. There are Two Types of JavaScript statements.
True or False. A Compound statement is a simple statement.
False. A compound statements combines multiple levels of logic. Example would be an if then else statement.
True or False, certain words are reserved in JavaScript, meaning that you can not use them as Variables, identifiers or constant names within your program.
True.
What are the words that are currently reserved in JavaScript?
break case catch continue debugger default delete do else finally for function if in instanceof new return switch this throw try typeof var void while with
What are the words that start with B that are reserved in JavaScript?
break
What are the words that start with C that are reserved in JavaScript?
Case
Catch
Continue
What are the words that start with D that are reserved in JavaScript?
Debugger
Default
Delete
Do
What are the words that start with F that are reserved in JavaScript?
Finally
For
Function
What are the words that start with I that are reserved in JavaScript?
If
In
Instanceof
What are the words that start with N that are reserved in JavaScript?
New
What are the words that start with R that are reserved in JavaScript?
Return
What are the words that start with S that are reserved in JavaScript?
Switch