• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/79

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

79 Cards in this Set

  • Front
  • Back
To access an HTML element from JavaScript, you can use this method
getElementById
write a statement that tells the browser to write "Hello Dolly" inside an HTML element with id="demo"
document.getElementById("demo").innerHTML="Hello Dolly";
separates javascript statements. added at the end of each executable statement. makes it possible to write many statements on one line.
;
javascript elements are executed in what order
in the sequence they are written
groups of javascript statements
blocks
can be used to break up a code line WITHIN A TEXT STRING
\
single line comments stat with this
//
Multi-line comments start with _____ and end with ____
/*
*/
containers for storing information in JavaScript
JavaScript variable
used to declare a javascript variable
var
a text value is called a ____
string
When you assign a text value to a variable, but ______ around the value.
double or single quotes
When you assign a numeric value to a variable, should you put quotes around the value?
No.
creating a variable in JavaScript is most often referred to as ________ a variable
declaring
Used to assign a value to a variable
=
write a statement to declare a variable called "carname." Assign the value "Volvo" to the variable
var carname="Volvo";
write code that creates a variable called carname, assigns the value "Volvo," and puts the value inside an HTML paragraph with an id of "demo"


var carname="Volvo";
document.getElementById("demo").innerHTML=carname;
According to good programming practice, where should all variables be declared?
In one place at the beginning of your code.
If you declare a variable without a value, what happens?
The variable will have the value - undefined
Why might a variable be declared without a value
The value could be something that has to be calculated or something that is provided later, like a user input.
If you re-declare a variable without a value, will it lose it's current value?
No
Javascript has _______ ______, meaining that the same variable can be used as different types.
dynamic types
a variable that stores a series of characters like "John Doe" are called ________
a string.
What is the rule for using quotes inside a string?
You can use quotes inside a string, as long as they don't match the quotes surrounding the string.
Can numbers be written with decimals in Javascript?
Yes.
Extra large or extra small numbers can be written with ________ (_______) ________
scientific (exponential) notation.
What 2 values can Booleans have?
true or false.
Booleans are often used in _______ ______.
conditional testing.
write a series of statements that create an array called cars with the values of Saab, Volvo, and BMW.
var cars=new Array();
cars[0]="Saab";
cars[1]="Volvo";
cars[2]="BMW";
write a condensed array called cars with the values of Saab, Volvo, and BMW.
var cars = new Array("Saab","Volvo","BMW");
write a literal array called cars with the values of Saab, Volvo, and BMW.
var cars = ["Saab","Volvo","BMW"];
an object is delimited by __
{}
Inside curly braces, an object's properties are defined as _______ and _______ _______.
Name and value pairs (name : value)
What are object properties separated by?
commas (,)
write a statement to create an object named "Person." Assign the name of firstname with a value of John, a name of lastname with a value of Doe, and a name of id with the value of 5566.
var person={
firstname : "John",
lastname : "Doe",
id : 5566
};
In what 2 ways can you address object properties?
name=person.lastname;
name=person["lastname"];
the value of a variable with no value is
undefined
variables can be emptied by setting the value to _____
null
When you declare a new variable, you can declare its type using this keyword.
new
Are variables objects?
yes
data, with properties and methods.
object
values associated with an object
properties
actions that can be performed on objects
methods
In object oriented languages, this is another name for properties and methods
object members
the syntax for accessing the property of an object
objectName.propertyname
the syntax for calling a method
objectName.methodName()
in object oriented languages, it is common to use _____-____ function names.
camel-case (ie: functionName)
a block of code that will be executed when someone calls it
function
JavaScript Function Syntax
a code block inside curly braces, preceded by the keyword "function."
At what point is the code inside a function excecuted
when someone calls the function
what caps is used when using the function keyword
lower case
what do you call a value that is passed into a function?
argument or parameter
How many arguments can be passed into a function
As many as are desired
how do you separate multiple arguments within a function?
using a comma
A statement that is used to return a value back to where the call was made
return
Can you use a return statement to exit a function?
Yes
A variable declared (using var) within a JavaScript function becomes ___________ and can only be accessed from within that function.
Local
Can you have local values with the same name in different functions? Why or why not?
Yes, because local variables are only recognized by the function in which they are declared.
Variables declared outside of a function are ________ and all scripts and function on the web page can access it.
Global
When are local variables deleted?
When the function is completed
When are global variables deleted
When the page is closed.
If you assign a value to a variable that has not yet been declared, what happens?
The variable will automatically be declared as a global variable.
What operator is used to assign values to JavaScript variables
=
What is the arithmetic operator for Modulus (division remainder)?
%
What is the arithmetic operator for incremental values
++
What is the arithmetic operator for decremental values
--
What operator is used to add string variables or text values together?
+
Adding two numbers will return the sum. However, adding a number and a string will return a _________.
String
What operators can be used to test for True or False?
Comparison and Logical operators
Comparison operator for "is equal to"
==
Used in logical statements to determine equality or difference between variables or values
Comparison operators
Comparison operator for "is exactly equal to (value and type)
===
Comparison operator for "is not equal to"
!=
Comparison operator for "is not equal (neither value or type)"
!==
Used to determine the logic between variables or values
Logical operators
Logical operator for "and"
&&
Logical operator for "or"
||
Logical operator for "not"
!
Syntax for a conditional operator that assigns a value to a variable based on some condition.
variablename=(condition)?value1:value2