JavaScript Flashcards

1
Q

Front-End vs. Back-End Programming

A

Front-End

  • Writing code that runs in the browser
  • Faster to respond to user interaction

Back-End

  • Writing code that runs on the server
  • Slower to respond to user interaction
  • Can be used for more than just user interaction
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where does the code written during front-end programming run?

A

The broswer

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Where does the code written during back-end programming run?

A

The server

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What are arrays used for?

A

Arrays are used to store multiple values in a single variable

An ordered collection of values
Each value is called an element
Each element has a numeric position in the array that is know as its index
Indexes are zero-based

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

JavaScript Types

A

Primitive Types - numbers, strings, booleans, null, undefined

Object Types - can apply to anything that’s not a primative type - collection of Keys and Values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

what does array.push(“”) do?

A

Adds a element to the end of an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

what does array.pop(“”) do?

A

deletes an element from an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

what does array.concat(array2) do?

A

adds array and array2 together

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Implicit Type Conversion

A

Performed automatically by JavaScript
11 + “ “ //output: “11” (number 11 converts to string “11”)
“15” + 15 //output: “1515” (concatenates “15” and 15 into a string)
“10” - “5”//output 5 (both strings convert to numbers)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Explicit Type Conversion

A

Performed explicitly in code:
String(25)//Output: “25” (number 25 converts to a string)
Number(“25”)//Output: 25 (string “25” converts to a number)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What are the three ways to declare a variable and how do they differ?

A
  • var - globally scoped. define the variable outside of a function, can be declared and redeclared
  • let - block scoped. must be defined within { } - can be updated but not redeclared
  • const - cannot be updated or redeclared - constant
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Expression vs. Statement

A

An expression is any code that can evaluate to a value

A statement is an instruction to do a certain action

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Loose vs Strict Equality

A

Loose ==
Checks if two operands are equal (tries to convert the values to a common type before checking for equality)

Strict ===
Checks if two operands are equal (checks if the types are equal as well)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Iteration

A

Repeating a process (lines of code)

Helpful for processing every element in an array

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

The three clauses of a For Loop

A
  1. Initializer - runs before the loop
  2. Condition - a boolean expression that stops the loop when it’s false
  3. Afterthought - runs at the end of each cycle of the loop
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

While Loops

A

Will execute a code block as long as the desired condition is true

17
Q

Parts of a function

A
  • Function keyword
  • Function name
  • Parentheses
  • Function body
18
Q

How do you invoke a function

A

Function name
Parenthesis

functionName()

Functions can be used multiple times

19
Q

Parameters and Arguments

A

Parameters and arguments allow you to make functions that are more generic, using variables that can have different values each time the function runs

20
Q

How are parameters formatted

A
  • Variable inputs for a function
  • Listed where a function is defined
  • between the parentheses
  • separated by commas
21
Q

How are Arguments Formatted?

A
  • Listed where a function is invoked
  • Between parentheses
  • Separated by commas