Es6 Flashcards

1
Q

What is a code block? What are some examples of a code block?

A

if statement, loops, functions / code block {}

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

What does block scope mean?

A

variable defined within a block {} can not be accessed outside of the block

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

What is the scope of a variable declared with “const” or “let”?

A

block scope, var is a function scope

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

Why is it possible to .push() a new value into a const variable that points to an array?

A

const is storing a reference to the array, you’re not modifying the array

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

How should you decide which type of declaration to use?

A

Use Let if you want the variable to be mutable, use Const if variable can not be reassigned

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

What is the difference between Let and Const?

A

Use Let if you want the variable to be mutable, use Const if variable can not be reassigned

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

What is the syntax for writing a template literal?

A

using backticks `, \n\ for multi-line (when escaping to the next line), ${variableName}

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

What is “string interpolation”?

A

string formatting so that we can substitute a part of the string for values of variables or expressions

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

What is destructuring, conceptually?

A

taking apart something

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

What is the syntax Object destructuring?

A

const, opening curly brace, name of property, closing curly brace, assigned to the object

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

What is the syntax for Array destructuring?

A

const, [variables, variables, variables] assigned to arrayName

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

How can you tell the difference between destructuring and creating Object/Array literals?

A

var/const/let {} = objectName, var/const/let []= arrayName

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

What is the syntax for defining an arrow function?

A

=>

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

When an arrow function’s body is left without curly braces, what changes in its functionality?

A

With {}, there must be a return statement, without just defines an arrow function. => expression VS. => { statements }

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

How is the value of this determined within an arrow function?

A

where the function is defined

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

What is a CLI?

A

command-line interfaces processes commands to a computer program using lines of text. Examples of this are text-based user interfaces and keyboard shortcuts

17
Q

What is a GUI?

A

graphical user interface, allows users to interact w/ devices through graphical icons and audio indicators instead of text-based user interfaces, typed command labels or text navigation

18
Q

Give at least one use case for each of the commands listed in this exercise.

A
man = to see the system reference manuals, ex. find the manual for executable programs or shell commands 
cat = concatenate files and print on the standard output, ex.-n, --number makes number all outputlines
ls = list directory contents q
pwd = print name of current/working directory
echo = display a line of text
touch = changes file timestamp
mkdir = make directories
mv = move (rename) files
rm = remove files and directories
cp = copy files and directories
history = show GNU history library
19
Q

What are the three virtues of a great programmer?

A

laziness, impatience, and hubris