What is the difference between HTML, CSS and JavaScript?
HTML=structure/framework
CSS=design
JavaScript=interactive features
How does the computer interpret the world through code?
Uses a model of an object; object-oriented programing
Describe objects:
*objects are things:
-they have properties, events, and methods
-properties+events+methods=object
Describe events:
*involve user interactions
-programmers choose what events trigger a specific section of code
-scripts can trigger different types of functionality
Describe methods:
*how people interact with objects
-second part of the code after period (member operator)
Identify the event and method
document.write(‘Good afternoon!’)
event method
|------------| |-----------------------------|
document.write(‘Good afternoon!’)
Describe how computers interpret the code:
Events trigger methods and methods retrieve or update an objects properties
Describe variables
store temporary bits of information to perform a task
Identify the variable and name
var boldColor | let boldColor
variable name
|----| |---------|
var boldColor
what are the variable keywords?
var
let
const
how do you declare a variable?
give it a name (identifier)
describe value
data that is stored within the variable
a value must be assigned to a variable
What are the different data types?
Numeric, strings, boolean
Describe the numeric data types
can be decimals or negative numbers
cannot have commas
describe strings
consist of letters and characters
add content to a page
always within ‘single’ or “double” quotation marks
describe booleans
can only have 1 of 2 values, true or false
describe arrays
a special type of variable that stores a list of values
what are the characteristics of an array
always in [square brackets] or array()
used for a list or set of values, useful if the number of items will vary
always separated by commas, uses ‘single’ or “double” quotes
index starts with 0
ex:
let stopLight;
stopLight = [‘yield’, ‘stop’, ‘walk’];
stopLight[1] = ‘go’
describe what is happening in this script
ex:
let stopLight;
stopLight = [‘yield’, ‘stop’, ‘walk’];
stopLight[1] = ‘go’
stopLight has an index of 1 which would be stop, but it is set equal to go, so stop is being changed to go making the stopLight array [‘yield’, ’go’, ‘walk’]
describe expressions
result in a single value
describe operators
used to create a single value from one or more values
what are the 4 different operators?
assignment (=)
string (+)
logical (&&)
comparison (> | <)
what is the assignment operator
=
assigns a value to a variable
what is the string operator
+
combines two strings
what is the logical operator
&&
combines expressions as true or false (boolean)
what is the comparison operator
<
compares values
explain this script
describe functions
a series of statements that are grouped to perform a task
describe conditions
conditions determine a path to take
returns a true or false value (boolean)
describe conditional statements
if a condition is met, then a statement is executed
else code executes a different statement (AKA code skips ahead)
if statements compares value to true
else if the value is false
describe the DOM
document object model
views and changes the output of HTML without actually changing the original HTML
what is the entry node of the DOM tree?
document node