JavaScript theory Flashcards
Set
A set is an unordered collection of elements without duplicate entries.
what is javascript
This is what makes your site interactive and your website feel like an app
sets are used for
membership testing (if a specific element belongs to the set) and eliminating duplicate entries.
list comprehension
a way to create a new list with less syntax
Iterable
object that can be iterated (repeated) or looped over.
what does alert keyword do
pop up to gives user a message
text string
string or message enclosed in quotes
is semicolon needed in js
In JavaScript, the use of semicolons at the end of statements is generally optional, but it is considered a best practice to include them.
what is a statement
instructions that are executed by the browser
what is a variable
a word that refers to a particular value
Variables takes on a particular value when you _______ the value to it
assign
in alert if you have a number it is automatically converted to a string and displays it
true
Wherever you can use a number, you can use a _____ expression.
math
for n++ When the pluses come after the variable, its original value is assigned to the new variable __when____ the incrementing variable is incremented.
before
what can you use to eliminate ambiguity in math expressions
parentheses ( )
Using the plus operator, the code combines—_________—three elements into the
message:
concatenates
if string message and number are concatenated using the + sign, what happens to the number in here
they are automatically converted from numbers to strings.
A ___ box asks the user for some information and provides a response field for her
answer.
prompt
To capture the user’s response you need to start by declaring a ___
variable
in prompt if the user enter a number what will happen
its converted to a string automatically
In prompt, If the user enters nothing and clicks OK, the variable is assigned
an empty string: “ “
In prompt, If the user clicks Cancel, the variable is assigned
a special value, null.
what is null
intentional absence of value - indicate that a variable or object property does not currently point to any meaningful value.
what is empty string
a string with zero characters - used when you need a string data type, but there’s no actual textual content.
for an if statement the condition is enclosed in
parentheses ( )
just an equal = sign is reserved for
assigning values to a variable