Sr side Flashcards

1
Q

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

A

the code inside brackets

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

use const, and if you HAVE TO, use let

A

true

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

What does block scope mean?

A

it means things only apply inside the code block

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

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

A

block scope, they stay inside the code block

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

What is the difference between let and const?

A

const is immutable, let is not
const cannot be reassigned,

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

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

A

tho it can’t be reassigned, the value can be changed and added to a variable in arrays (and others?)

robert says this is a language problem

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

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

A

Always use const unless the compiler says you cannot. Robert says it is better to default to const

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

What is the syntax for writing a template literal?

A

backtics and ${ }

in the substitution you can put an expression (do math, function calls (JS functions always return a value, even if undefined))

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

What is “string interpolation”?

A

the ability to substitute part of the string for the values of variables or expressions

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

should you use string interpolation if you don’t substitute?

A

no, just use quotation marks as interpollation is not needed. Robert’s quote is that just because you can do something it doesn’t mean you should do something.

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

What is destructuring, conceptually?

A

an alternative, way to assign properties of an object to variables …

… which can be done efficiently in batches?

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

What is the syntax for Object destructuring?

A

let { property1: variable1, property2: variable2 } = object;

curly braces

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

What is the syntax for Array destructuring?

A

square braces

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

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

A

which side the equal sign shows up on

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

What is the syntax for defining an arrow function?

A

On the left you need parentheses for no parameters or more than one parameter. If it’s just one parameter then you don’t need any parentheses. Then you need the arrow, and on the right side you need the expression or if it is an object or something you need curly braces

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

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

A

it returns the expression

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

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

A

It doesn’t work. Arrow functions do not accept the this keyword

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

Per Robert, should you ever not use parens in arrow functions?

A

You should always use the, even if there is only one parameter, and even tho u technically can omit the parens

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

What is a CLI?

A

command line interface

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

What is a GUI?

A

it is like cli but it’s graphic

(vs code has a gui of the cli for github)

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

What are the three virtues of a great programmer?

A
  1. Laziness: The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful and document what you wrote so you don’t have to answer so many questions about it.
  2. Impatience: The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least pretend to.
  3. Hubris: The quality that makes you write (and maintain) programs that other people won’t want to say bad things about.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
22
Q

What are the 3 components of a fullstack Web architecture?

A

The frontend that the user interacts with (Web site or Mobile app)

The backend server that takes requests from the frontend and processes them

The database where data is stored and used across all instances of the frontend

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

What is Node.js?

A

Node.js is a program that allows JavaScript to be run outside of a web browser.

extra:
It is commonly used to build backends for Web applications, command-line programs, or any kind of automation that developers wish to perform. Node.js is powered by V8; the same JavaScript engine in the Google Chrome browser. It is free, open-source software and its source code is available on GitHub.

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

What can Node.js be used for?

A

It is commonly used to build backends for Web applications, command-line programs, or any kind of automation that developers wish to perform.

25
Q

What is a REPL?

A

A read–eval–print loop (REPL), also termed an interactive toplevel or language shell, is a simple interactive computer programming environment that takes single user inputs, executes them, and returns the result to the user; a program written in a REPL environment is executed piecewise.[1] The term usually refers to programming interfaces similar to the classic Lisp machine interactive environment. Common examples include command-line shells and similar environments for programming languages, and the technique is very characteristic of scripting languages.[2]

26
Q

When was Node.js created?

A

2009

27
Q

What backend languages have you heard of?

A

Ruby, PHP, Java, . Net, and Python….

28
Q

What is a computer process?

A

a process is the instance of a computer program that is being executed by one or many threads.

29
Q

Why should a full stack Web developer know that computer processes exist?

A
30
Q

What is the process object in a Node.js program?

A

the info running on the node thing

31
Q

How do you access the process object in a Node.js program?

A

it is just available for access when accessed

32
Q

What is the data type of process.argv in Node.js?

A

an array of strings, always

33
Q

How do you access the command line arguments in a Node.js program?

A
34
Q

Robert Gardner:

“The best way to organize your code is to do all the handling of the user input upfront in one place, and all the output to the user at the bottom in one place. Then all the logic is in the middle.

This gives you more flexibility to change your mind about the user interface. For example, you might decide to write a GUI instead of a CLI. It also makes the code more organized and understandable.”

A
35
Q

What is a JavaScript module?

A

a file which has JS in it

36
Q

What are the advantages of modular programming?

A

organization, keep code succinct

37
Q

In JavaScript, how do you make a function in a module available to other modules?

A

export it using the “export” keyword
(use curly braces if you do’nt have the default?)

38
Q

In JavaScript, how do you use a function from another module?

A

importing it using the “import” (function) “from” keywords
(use curly braces if you do’nt have the default?)

39
Q

What is the JavaScript Event Loop?

A

code is on queu to be run in order of those tasks

40
Q

What is different between “blocking” and “non-blocking” with respect to how code is executed?

A

non blocking is in queu for event loop,

41
Q

asynchronous code is simply what?

A

when something is put onto the queu, then the next thing runs in JS immediately

42
Q

What is NPM?

A

the world’s largest software registry.

Use npm to . . .
Adapt packages of code for your apps, or incorporate packages as they are.
Download standalone tools you can use right away.
Run packages without downloading using npx.
Share code with any npm user, anywhere.
Restrict code to specific developers.
Create organizations to coordinate package maintenance, coding, and developers.
Form virtual teams by using organizations.
Manage multiple versions of code and code dependencies.
Update applications easily when underlying code is updated.
Discover multiple ways to solve the same puzzle.
Find other developers who are working on similar problems and projects.

43
Q

What is a package?

A

bits of reusable code. npm is a registry where you can share your code or use others’ code

44
Q

How can you create a package.json with npm?

A

using the npm command,
e.g.
npm package.json

45
Q

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

A

is’nt it the package/code you’re using/depending on? it’s added to the package.json file

add one with “node install (package name)”?

46
Q

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

A
47
Q

What are some other popular package managers?

A

Yarn, PNPM

48
Q

What is Express useful for?

A

Express.js is an extremely popular and widely deployed web server framework for Node.js, known for its simplicity and ease of use.

it is used for implementing http endpoints

49
Q

How does Express fit into a full-stack web application?

A

used in node , sits on top of node, manages the http requests
middle man between front and back end

50
Q

How do you add express to your package dependencies?

A

npm install

51
Q

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

A

app.listen

a port is an endpoint of communication?

often used to identify specific services

52
Q

What is Express middleware?

A

it sits between request coming in and response going out

53
Q

What is Express middleware useful for?

A
54
Q

How do you mount a middleware with an Express application?

A
55
Q

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

A
56
Q

What is an API endpoint?

A

a url/path/

57
Q

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

A
58
Q

how do you send json on the http command line?

A

e.g.:
http PUT pie.dev/put name=John email=john@example.org

take note of the “ name=John email=john@example.org” portion, with spaces, as each is an argument

source: https://httpie.io/docs/cli/json