Senior Side Flashcards
(135 cards)
What is a code block? What are some examples of a code block?
a chunk of code that will do a specific task when appropriate (when the function is called or a conditional is met/true)
Examples: if statement, for loop, while loop, etc
What does block scope mean?
the variables exist only within the corresponding block; variables are not visible outside the block
as opposed to function scoped
What is the scope of a variable declared with const or let?
block-scoped
What is the difference between let and const?
let: you can reassign them to different values, but you can’t redeclare; you don’t need to initialize it with a value
const: immutable so you can’t reassign them to different values, nor can you redeclare; requires an initializer, const key-words are read-only variables
Why is it possible to .push() a new value into a const variable that points to an Array?
the reference to the variable is immutable but the value of the variable is not so you can manipulate it
How should you decide on which type of declaration to use?
determine whether or not you will need to reassign said variable; if you will need to reassign it at some point, use let. If not, you can use const
What is the syntax for writing a template literal?
wrap the string in backticks
any expressions or variables go inside curly braces with a dollar sign before
What is “string interpolation”?
the ability to substitute part of the string for the values of variables or expressions
What is destructuring, conceptually?
taking properties and values from an object and assigning their values to independent variable
What is the syntax for Object destructuring?
const {names you want to assign to your variables} = object
What is the syntax for Array destructuring?
const [names you want to assign to your variables] = array
How can you tell the difference between destructuring and creating Object/Array literals?
where the brackets/curly braces are
What is the syntax for defining an arrow function?
param => expression
( ) => expression
(param1, param2, … ) => expression
When an arrow function’s body is left without curly braces, what changes in its functionality?
without curly braces, implicit return will happen
if no curly braces, the expression must be a single expression
can’t have statements (eg. return, if, for loops etc)
How is the value of this determined within an arrow function?
an arrow function captures the this value of the enclosing context instead of creating its own this context
doesn’t have its own this value
lexical scope: where you wrote it
this is defined at the call time of its outer function (lexical scope)
What is a CLI?
Command-line interface processes commands to a computer program in the form of lines of text
What is a GUI?
Graphical user interface is a form of user interface that allows users to interact with electronic devices through graphical icons and audio indicator such as primary notation, instead of text-based user interfaces, typed command labels or text navigation
Give at least one use case for each of the commands listed in this exercise. man cat ls pwd echo touch mkdir mv rm cp
man- interface to online reference manuals (use when there’s a command you don’t know much about)
cat- concatenate files and print on the standard output (use when you want to see contents of file or even combine files together in a new file)
ls- list directory contents (when you want to see what is inside the current directory)
(-a do not ignore entries that start with .
- F append indicator to entries)
pwd- print name of current/working directory ( when you want to know which directory you are in currently)
echo- display a line of text (when you want to display text and possibly put that text into a file)
touch- create new files
mkdir- make directories
(-p makes parent directories as needed)
mv- rename files/directories
rm- delete files
(-r removes directories and all their contents
-f ignore nonexistent files and arguments, never prompt)
cp- copy files and directories
(-r copy directories recursively)
What are the three virtues of a great programmer?
Laziness, Impatience, Hubris
What is Node.js?
a program that allows JavaScript to be run outside of a web browser
an asynchronous event-driven JavaScript runtime
Node.js is a set of libraries for JavaScript which allows it to be used outside of the browser
What can Node.js be used for?
used to build back ends for Web applications, command-line programs, or any kind of automation that developers wish to perform
It is primarily focused on creating simple, easy-to-build network clients and servers
What is a REPL?
Read-Eval-Print-Loop
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
An example of a repl is the inspect tools
When was Node.js created?
2009
What back-end languages have you heard of?
Python, Ruby, php, Java, C#, Perl, coldfusion, Scala, JavaScript, Go, Rust, C, C++, cobol, kotlin, clojure, crystal, elixir, erlang
.net (framework in C#)
SQL (database)
frameworks are libraries written within a language