Learn Enough to be Dangerous Flashcards

1
Q

Who created JavaScript?

A

Brendan Eich

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

What is the purpose of JavaScript?

A

To write programs that execute on the web.

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

What is a function?

A

A piece of code that takes in arguments and performs some task with them.

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

What is a REPL?

A

a program that reads input, evaluates it, prints out the result (if any), and then loops back to the read step.

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

What are template literals?

A

Template literals are a way we can write strings with variables included using backticks and the ${variabe} syntax. ex ${firstName} ${lastName}

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

What does it mean if a function operates as a side effect? Give 2 examples

A

This mean that the function does something other than return a value.

Methods like .sort() and .reverse() mutates the arrays, permanently altering them.

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

What is a property?

A

a peice of data attached to an object

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

How are boolean values useful?

A

It is useful for control flow, allowing you to take actions based on the result of a comparison

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

Describe the &&(“and”), || (“or”), and !(“bang”) operators.

A

When comparing two booleans with &&, both have to be true for the combination to be true

|| lets us take action if either comparison (or both) is true

! (often pronounced “bang”), which just converts true to false and false to true

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

Define iteration

A

the practice of repeatedly stepping through an object one element at a time.

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

How would you access the last item in an array?

A

arr.slice(arr.length -1) or arr.slice(-1)

to access just the element arr.slice(-1)[0]

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

Describe 2 ways a number can be converted to a string

A

100.0.toString() or String(100.0)

The extra dot must be included so that JS treats the number as a float as it doesn’t handle integers very well

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

How would you convert a string into a number?

A

parseInt(n)

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

Whate is an object?

A

referring to the abstract idea of a collection of data (properties) and functions (methods). Within each object or key/value pairs. The keys are written as strings

(almost) everything in JavaScript is an object

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