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;
35 Cards in this Set
- Front
- Back
open Javascript Console in Chrome |
Option + Command + J on a Mac |
|
What does REPL stand for and what does a REPL do? |
REPL stands for read, evaluate, print loop. A REPL lets you type in code and evaluate it on the fly, basically letting you watch your code execute as you type. |
|
Write a statement that evaluates to the number 22 in the console. |
20 + 2 |
|
What would the string “i’m a string” evaluate to in the console? |
“i’m a string” |
|
What is string concatenation? Give an example. |
String concatenation is combining two or more strings into a single string. For example: “Hello ” + “ World” = “Hello World” |
|
How can you access previous commands in the console? |
Press the up key. |
|
What does the .alert() function do? |
The alert function opens up a pop-up box with whatever text you pass to it. |
|
What does .prompt() do? |
The prompt function opens up a pop up box with a text field that allows the user to type an answer, which it will then return to your code. |
|
What are the seven data types in JavaScript? |
Numbers, Strings, Boolean, Objects, Functions, Null and Undefined. |
|
What is the difference between null and undefined? |
Undefined means that a variable does not yet have a value, while null means that a variable has no value whatsoever. |
|
Enter an expression in the console that evaluates to NaN. |
parseInt(“Hello”); |
|
How can you determine the type of a value in JavaScript? |
The typeof operator. typeof 15 typeof “cats” typeof alert typeof 15/”cats” |
|
> |
greater than |
|
< |
Less than |
|
== |
equality (converts the operands if they are not of the same type, then applies strict comparison) |
|
=== |
strict equality (if two operands are strictly equal without type conversion) |
|
!= |
not equals |
|
!== |
strict not equals (if two operands are strictly not equal without type conversion) |
|
>= |
greater or equal |
|
<= |
less or equal |
|
(*) |
multiplication |
|
(/) |
division |
|
(+) |
addition |
|
(-) |
substraction |
|
(%) |
modulus |
|
What is the % operator called and what does it do? |
The % operator is the modulus operator in JavaScript and it returns the remainder from dividing the two arguments. 5 % 2 = 1 (5 / 2 = 4) (5 - 4 = 1) remainder is 1 |
|
What is the order of arithmetic operations in JavaScript |
PEMDAS Parenthesis, Exponents, Multiplication, Division, Addition, then Subtraction. |
|
What is string concatenation and how do you do it? |
String concatenation combines two strings together. String concatenation is accomplished with the + operator with two strings as arguments. |
|
What happens if you concatenate a string and a number? |
The number is converted to its string equivalent and then regular string concatenation occurs. EX: “Hi” + 1 = “Hi1” |
|
What does it mean to “escape” a character? Give some examples of escaped sequences in JavaScript. |
The backslash escape character turns special characters into string characters: examples are: \n, the newline character, \, the backslash escape character, and \t, the tab character, to name a few. |
|
How can you quickly determine the length of a string? |
Apply the length property on the string. hello = 'Hello World'; console.log(hello.length); |
|
Declare a variable whose name is car and assign your favourite car to it. |
var car = "Skoda" |
|
Find the length of the following sentence without manually counting the characters and spaces: var sentence = "Please use the Contact us facility if you have any further issues or to report this e-mail as suspicious" |
sentence.length |
|
Let’s say we start with an empty parking lot. In the morning, people go to their jobs and want to secure their parking spot. Declare a variable called numCars and set its value to 0. Then, increment the variable by seventy, but without using the variables name twice in the new statement. |
var numCars = 0; numCars += 70; |
|
When the cars get into the parking lot, the car count is reported to the central controlling unit of the parking lot. Build a string called carCounterMessage that uses numCars to say: "There are now 70 cars in the parking lot!" You should not hardcode any value. |
var numCars = 0; numCars += 70; var carCounterMessage = "There are now " + numCars + " in the parking lot!" |