WD Flashcards
cli
What does it stand for? What is it?
Command line interface
Text-based interface where you can input commands that interact with a computer’s operating system
(Ex. Bash, cmd, powershell)
gui
What does it stand for? What is it?
Graphical user interface
Form of user interface that allows users to interact with electronic devices through graphical icons and visual indicators
(Ex. Windows, macOS, and android environments, the files/folders you see on the desktop)
jsx
What is it?
(JavaScript XML)
A syntax extension for JavaScript that lets you write HTML-like markup inside a JavaScript file
- simply: what let’s you write HTML in a JavaScript file
Hooks
- are specific to react
- classes are a part of JavaScript
./
Ex: ‘./index.css’
Means it’s in the same folder
export default
How many things does it export?
1
State
Is a built-in React obj that is used to contain data / information about the component
JSON
What does it stand for? What is it?
JavaScript Object Notation
- it is a lightweight data interchange format for storing and exchanging data
- used to transmit data between server and web app
- represented as key-value pairs (similar to obj literals in JS)
- text, in JS object notation
JSON.parse()
What does it do?
Translates JSON into a JavaScript object
JSON.stringify()
What does it do?
Translates a JavaScript obj into JSON
../
Means exit the folder that you’re in
Promise
What is a promise?
Promise is an obj..that produces a single value sometime in the future
- resolve value or reject
3 states of a promise
- fulfilled
- rejected
- pending
AJAX
what does it stand for? what is it? what does it do?
Asynchronous JavaScript and XML
- it is a technique/method that allows you to create asynchronous web apps
- allows parts of the web page to be updated without reloading the entire page
- it sends and retrieves data in the background while the user interacts with the page
Benefits of AJAX
- page updates quicker
- less data is downloaded on updates which results in less wasted bandwidth
- feels faster and more responsive because you don’t have to wait for the page to refresh
Async/Await (es8)
What does async do? What does await do?
Async makes a function return a promise
Await makes an Async function wait for a promise
- Async/await is built on top of promises
- allows you to write asynchronous code in synchronous manner
- doesn’t have resolve or reject params
- everything after await is placed in an event queue
CDN
What does it stand for?
What is it?
Content Delivery Network
Is it a network of interconnected servers that speeds up webpage loading for data-heavy applications
DNS
What does it stand for?
Domain Name System
API
What does it stand for?
Application Programming Interface
console.error vs throw new error
What is the difference?
console.error
- method provided by browser’s console obj in JS
- used to log error messages in console
- does not stop the execution of a program
throw new Error
- used to explicitly throw an exception(an error) in JS
- used when you want to indicate that something unexpected happened and you want to stop the normal flow of the program
Benefits of CDN (content delivery network)
- faster content delivery: users can access content from a server that is physically closer to them, reducing latency and improving page load times
- improve website performance: CDNs cache static content(img, Stylesheets, scripts, etc) on edge servers. Cached content can be served directly from the edge server, reducing load on the origin server and speeding up content delivery
- loading balance
- distributed global presence
- bandwidth savings
- security enhancements
- scalability
- caching strategies
- cost efficiency
- content analytics
.finally() (es9 2018)
When is it used?
Good for when you need to run a piece of code no matter what after a promise
for await of (es9 2018)
What does it do?
Creates a loop that iterates over an array of async iterable objs, as well as sync iterables
Promise.allSettled() (es2020)
Takes an array of promises and returns a single promise, an array of objs that describe the outcome of each promise
Promise.all() (es6)
A method that lets you iterate through an array of promises and returns an array of fulfilled values
What does REST in RESTful API stand for?
Representational State Transfer
What are the standard http methods?
GET - getting data
POST - creating data
PUT - updating data
DELETE - deleting data
What is REST?
An architectural style for designing networked applications. (Set of constraints or principles that dictate how web services should be designed
RESTful APIs are based on the principles of REST )
Parts of useState
const [state variable (ex. index), state setter function (ex. setIndex] = useState(0);
Environment variables (.env files) [don’t forget, still not best practice and not secure]
What do you use it for?
You store things like api keys
Then put the .env file into gitignore
What is node.js?
It is a program that allows JavaScript to be run outside the web browser (created with v8 engine)
before you could only run it on the browser because they were the only ones that had the JS engine (like v8)
- commonly used to build backends
- written in combo of JS and C++
- Python and Perl used to automate the build process of Node.js source code
Common js what do you know about it?
Export and import is different
Import you use const __ = require()
Export: module.exports = __
Top level await only works where?
Inside modules
Other times you still need async function
Difference between require() and import
Require(): part of CommonJS (older) / it is synchronous
Import: es6 and up, asynchronous
Req.query, what is it/what do you get?
It is an obj containing the parsed query params from the URL
- Query params are included in the URL after the ?
- used to send data to the server as key-value pairs
Req.body, what is it/what do you get?
It is an obj containing data submitted to the server in the body of POST/PUT/PATCH request
Req.headers, what is it/ what do you get?
It is an obj containing the HTTP headers that were sent to the client in the HTTP requests
Req.params, what is it/what do you get?
It is an obj that contains route parameters
Placeholders in the route pattern specified when defining a route
Captures values from the actual URL
res.send, what is it/what does it do? What can you attach before it?
It is a method used to send a response to the client
Can be used to send various types of responses (plain text, HTML, JSON, etc)
It automatically sends the appropriate “content-type” header based on the type of data being sent
You can attach .status()
Ex: res.status(404).send(“not found”)
const fs = required(“fs”);
What is fs?
Fs stands for file system
It allows you to access your file system
Res.json, what is it/what do you get?
It is a method specifically designed to send JSON responses to the client.
- Automatically sets “Content-Type” header to ‘application/json’ and converts the provided JS obj to a JSON string before sending it in the response
DBMS
Database management system
Collection of programs that allow us to access databases and work with data allows control access to database users
Schema
Relation between tables and fields
What does REPL stand for? what is it?
Read - eval - print - loop
it 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 REPL environment is executed piecewise
what is a computer process?
Simply = an active application
a process is the instance ( result of an instantiation process of a virtual or physical computer system )of a computer program that is being executed by one or many threads ( a thread of execution is the smallest sequence of programmed instructions that can be managed independently by a scheduler, which is typically part of the operating system
- thread is a component of a process )
What is a “module” in JavaScript?
Single js file
Array.filter()
All strings have indexOf(), startsWith(), includes() methods