Basic JS Flashcards
Javascript is dynamically typed, what does that mean?
We can put any type in a variable. For example, a variable can at one moment be a string and then store a number:
What does the number type represent?
Both integer and floating point numbers.
Besides regular numbers, there are so-called “special numeric values” which also belong to the number data type, what are they ?
Infinity, -Infinity and NaN.
NaN is sticky. What does that mean?
Any further mathematical operation on NaN returns NaN:
What is the largest value the “number” type can safely represent?
((2^53)-1)
BigInt type was recently added to the language to represent integers of arbitrary length. How do you define a BigIng value?
A BigInt value is created by appending n to the end of an integer.
What can we do with backticks in Javascript?
Backticks are “extended functionality” quotes. They allow us to embed variables and expressions into a string by wrapping them in ${…}.
Is there a char in Javascript?
No, There is no character type.
What type does the null value belong to ?
It forms a separate type of its own which contains only the null value:
What is the meaning of null ?
It’s just a special value which represents “nothing”, “empty” or “value unknown”.
What is the meaning of undefinedl ?
The meaning of undefined is “value is not assigned”. If a variable is declared, but not assigned, then its value is undefined:
What is the The typeof operator and what does it do ?
The typeof operator returns the type of the operand. It’s useful when we want to process values of different types differently or just want to do a quick check.
What happens when we try to concatenate a string and a number?
You might expect this to return an error, but it works just fine. How numbers should be displayed as strings is fairly well-defined, so the browser automatically converts the number to a string and concatenates the two strings.
If we have a numeric variable that we want to convert to a string, we can use ?
The String() function converts its argument to a string.
If we have a string that we want to convert to a numeric variable, we can use ?
The Number() function converts anything passed to it into a number, if it can.
The length property returns ?
The length of a string
There are 3 methods for extracting a part of a string, what are they ?
slice(start, end)
substring(start, end)
substr(start, length)
How do open dev tools on keyboard?
opt, commmand, c
What are return values?
The values that a function returns when it completes
What are parameters,in Javascript functions?
In JavaScript, parameters are the items listed between the parentheses in the function declaration.