es6 Flashcards

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
Q

mv

A

it moves files or renames them

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

rm

A

it removes files or directories

27
Q

cp

A

copy files and directories

28
Q

What is Node.js?

A

As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.

29
Q

What can Node.js be used for?

A

for handling back end server requests

30
Q

What is a REPL?

A

an interactive shell that processes Node. js expressions

31
Q

When was Node.js created?

A

it was created May 27, 2009

32
Q

What back-end languages have you heard of?

A

java

33
Q

what is a directory?

A

a folder on our hard drive that holds files

34
Q

what is a relative file path?

A

internal path in same directory file path relative to where you’re currently at

35
Q

what is an absolute file path?

A

the full file path to get to a specific file/folder

36
Q

what module does node.js includes for manipulating the file system

A

fs module

37
Q

What method is available in the Node.js fs module for writing data to a file?

A

fs.writefile

38
Q

Are file operations using the fs module synchronous or asynchronous?

A

asynchronous

39
Q

What is a client?

A

clients are devices that request service from the server

40
Q

What is a server?

A

A server is a computer program or device that provides a service to another computer program and its user

41
Q

Which HTTP method does a browser issue to a web server when you visit a URL?

A

GET

42
Q

What is on the first line of an HTTP request message?

A

the method the target and the version

43
Q

What is on the first line of an HTTP response message?

A

the status line

44
Q

What are HTTP headers?

A

let the client and the server pass additional information with an HTTP request or response

45
Q

Is a body required for a valid HTTP message?

A

no

46
Q

What is NPM?

A

it’s open-source for sharing and borrowing packages

47
Q

What is a package?

A

is a directory with one or more files in them

48
Q

How can you create a package.json with npm?

A

by using the command npm init -y

49
Q

What is a dependency and how do you add one to a package?

A

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
Q

What happens when you add a dependency to a package with npm?

A

it installs to the directory we are working on

51
Q

How do you add express to your package dependencies?

A

by using the command npm install express

52
Q

What Express application method starts the server and binds it to a network PORT?

A

the listen method

53
Q

How do you mount a middleware with an Express application?

A

by using the send method

54
Q

Which objects does an Express application pass to your middleware to manage the request/response lifecycle of the server?

A

req and res

55
Q

What is the appropriate Content-Type header for HTTP messages that contain JSON in their bodies?

A

application/json; charset=utf-8

56
Q

What is Array.prototype.filter useful for?

A

filtering the array

57
Q

What is Array.prototype.map useful for?

A

creating a new version of the array

58
Q

What is “syntactic sugar”?

A

its designed to make the code easier to read

59
Q

What is the typeof an ES6 class?

A

function

60
Q

Describe ES6 class syntax.

A

class keyword and the constructor

61
Q

What is “refactoring”?

A

restructuring the code without changing its behavior

62
Q

What does express.static() return?

A

a function

63
Q

What is the local __dirname variable in a Node.js module?

A

a dirname gives us the directory name

64
Q

What does the join() method of Node’s path module do?

A

it joins the path together