JavaScript Flashcards
What is a variable?
container to store data
What is a string?
characters
What is the difference when it comes to using single quotes or double quotes ( ‘ ‘ or “ “ )?
nothing
How do you escape quotation characters?
\
What is type coercion?
converting type
What is a number in JavaScript?
a data type
What is an arithmetic operator?
mathematical function
Name four of the arithmetic operators?
+ - * / %
Why is the typeof an object null?
object
What is the difference between null and undefined?
null is assigned null
undderfined is no assigned value
Why do you always use === for comparisons?
to make sure data type are same
eg 0 is a falsy value but ‘0’is truthy
What is the difference between undefined and null?
undefined is never assigned value;
null use to assign variable is needed to represent no value
What is a function?
a group of statement to do some special task.
Why are functions useful?
templating reusable
How do you call a function?
Function name with parentheses and argument
What are the parts of a function definition?
Function Keyword Function Name Parameter Code Block Return inside Code Block
What is the difference between a parameter and an argument?
parameter is part of function definition
argument is the value to pass in when call the function
Why are variables useful?
remember value, store data
What two special characters can a variable begin with?
$ _
How do you declare a variable?
using variable keywords
var const let
How do you assign a value to a variable?
assignment operator =
Are variables case sensitive?
yes
Which words cannot be used as variable names?
Reserved word
eg if function var while …
Do all if statements require an else statement?
no