Quiz Questions Flashcards
When was Typescript Introduced and by whom?
October 2012 by Microsoft
How can you compile Typescript into Javascript
change directory (cd folder)
npx tsc –watch
What is the purpose of variables?
Storing data in a name to be reused.
How do you declare a variable?
Using keywords const or let.
How do you initialize a variable?
Using the assignment operator (=)
What characters are allowed in variable names?
letters, numbers, $, _
What does it mean to say that variable names are “case sensitive”?
two variables with the same text but different capitalization are different variables and don’t necessarily hold the same value.
What is the purpose of a string?
Holding text data.
What is the purpose of a number?
Holding integer and floating point data.
What is the purpose of a boolean?
To hold true or false data
What does the =
operator mean in JavaScript?
It is the assignment operator and is used to assign value to a variable.
How do you update the value of a variable?
If the variable is declared with the keyword ‘let’, you can reassign the value of that variable using the assignment operator or an incremental operator like “+=” or “-+”.
What is the difference between null
and undefined
?
Null is a value that is purposefully not provided. Undefined has an undeclared value
Why is it a good habit to include “labels” when you log values to the browser console?
To help clarify what the log is noting.
Give five examples of JavaScript primitives.
number
string
boolean
null
undefined
What data type is returned by an arithmetic operation?
Number
What is string concatenation?
Adds a string and another data type into a string.
What purpose(s) does the +
plus operator serve in JavaScript?
Adds numeric values together, string concatenation, and reassigning variables of other types into number.
What data type is returned by comparing two values (<
, >
, ===
, etc)?
Boolean
What does the +=
“plus-equals” operator do?
Adds the value in the variable with whatever is behind the operator, and then reassigns it to the same variable.
What is the syntax for writing a template literal?
backtick with string and any ${string interpolation} within
What is “string interpolation”?
The ability to add variable values into a string
What are objects used for?
Objects are used to hold various data and their pairs.
What are object properties?
The “key:value” pair that are housed within an object.
Describe object literal notation.
Various key:value pairs are separated by commas between curly braces and assigned to a variable.
How do you remove a property from an object?
delete variableName[“keyName”]
What are the two ways to get or update the value of a property?
dot notation and bracket notation
What is the purpose of interfaces in TypeScript?
Assigning data typing to the values of each property, so that data is not mismanaged upon creation.