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”
"); document. write(outputTwo); One Two Three Four 1 2 3 4