es6 Flashcards

(64 cards)

1
Q

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

A

i code block is whatever inside {}, functions, if conditions and loops all have code blocks

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

What does block scope mean?

A

it means that its scope only to whatever is inside the curly braces

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

its scope to only inside the code block

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

What is the difference between let and const?

A

let is changeable but const is not

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

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

A

because we are pushing elements to the array but we are not reassigning the array.

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

How should you decide on which type of declaration to use?

A

let is usually used on variables that will have their values changed or reassigned. const is used for objects or arrays or values that will stay consistent throughout the function

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

the syntax is backticks ` `

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

What is “string interpolation”?

A

its embedding variables into a string and getting the results of it

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

What is destructuring, conceptually?

A

taking values from properties and assigning it to a different variables

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

What is the syntax for Object destructuring?

A

const {} = 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 [] = array

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

an object will have {} and an array will have []

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

it will return

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

a normal function will create its own content for this but the arrow function will inherit it

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

What is a CLI?

A

command-line interface

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

What is a GUI?

A

graphical-user interface

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

man

A

man gives us the option to view what a command name is a synopsis of the command and a description of what the command does

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

cat

A

it concatenates files and prints it

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

ls

A

the ls command gives us a list of our files or list directory contents

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

pwd

A

it prints the name of the current or working directory

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

echo

A

it displays a line of text

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

touch

A

change file timestamp

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

mkdir

A

it makes directories

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
25
mv
it moves files or renames them
26
rm
it removes files or directories
27
cp
copy files and directories
28
What is Node.js?
As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
29
What can Node.js be used for?
for handling back end server requests
30
What is a REPL?
an interactive shell that processes Node. js expressions
31
When was Node.js created?
it was created May 27, 2009
32
What back-end languages have you heard of?
java
33
what is a directory?
a folder on our hard drive that holds files
34
what is a relative file path?
internal path in same directory file path relative to where you're currently at
35
what is an absolute file path?
the full file path to get to a specific file/folder
36
what module does node.js includes for manipulating the file system
fs module
37
What method is available in the Node.js fs module for writing data to a file?
fs.writefile
38
Are file operations using the fs module synchronous or asynchronous?
asynchronous
39
What is a client?
clients are devices that request service from the server
40
What is a server?
A server is a computer program or device that provides a service to another computer program and its user
41
Which HTTP method does a browser issue to a web server when you visit a URL?
GET
42
What is on the first line of an HTTP request message?
the method the target and the version
43
What is on the first line of an HTTP response message?
the status line
44
What are HTTP headers?
let the client and the server pass additional information with an HTTP request or response
45
Is a body required for a valid HTTP message?
no
46
What is NPM?
it's open-source for sharing and borrowing packages
47
What is a package?
is a directory with one or more files in them
48
How can you create a package.json with npm?
by using the command npm init -y
49
What is a dependency and how do you add one to a package?
dependencies are packages that are required by the application in production, and to add one to the package we run the command npm install
50
What happens when you add a dependency to a package with npm?
it installs to the directory we are working on
51
How do you add express to your package dependencies?
by using the command npm install express
52
What Express application method starts the server and binds it to a network PORT?
the listen method
53
How do you mount a middleware with an Express application?
by using the send method
54
Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?
req and res
55
What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?
application/json; charset=utf-8
56
What is Array.prototype.filter useful for?
filtering the array
57
What is Array.prototype.map useful for?
creating a new version of the array
58
What is "syntactic sugar"?
its designed to make the code easier to read
59
What is the typeof an ES6 class?
function
60
Describe ES6 class syntax.
class keyword and the constructor
61
What is "refactoring"?
restructuring the code without changing its behavior
62
What does express.static() return?
a function
63
What is the local __dirname variable in a Node.js module?
a dirname gives us the directory name
64
What does the join() method of Node's path module do?
it joins the path together