When you execute javascript code, the JavaScript engine creates the global execution context, which has two phases: creation and execution.

During the creation phase, the JS engine moves the variable and function declarations to the top of your code. This process is known as hoisting.

Variable hoisting

console.log(greeting);var greeting = “Hello World!”

This code won’t cause an error and will result in the printing of “Hello World!” because the JavaScript engine hoists the variable declaration to the top of the script:

var greeting = “Hello World!”console.log(greeting)

During the creation phase, the JavaScript engine places the greeting variable in memory and…


For absolute beginners.

What is an array?

An array is a collection of data grouped and stored in a contiguous block of memory. An array can be made of any data type: string, boolean, number, an array of arrays, etc.

Advantages of arrays

The main advantage of arrays is the ability to look up any value in an array based on its index with O(1) time complexity.

const array = ["a", "b", "c"]// The value at array[0] is "a"
// The value at array[1] is "b"
// The value at array[2] is "c"

NOTE: indexing starts at 0.

Disadvantages of arrays

Elements cannot be added to an array when that original, fixed…


A beginner’s guide to assessing an algorithm use of computer memory

What is space complexity?

Space complexity is a way to evaluate how efficiently an algorithm uses computer memory. Although we’re talking about memory — think ‘bytes’ — space complexity is expressed using big-O notation, i.e., how much additional memory is required based on input size.

Any new data structure created during the algorithm's execution is considered new data requiring new or additional memory. Yes, even if the data doesn’t persist beyond the execution of the algorithm. This additional space in memory is called auxiliary space.

Wait, before we go on…

Auxiliary space is…


What is a closure?

According to MDN:

A closure is the combination of a function bundled together (enclosed) with references to its surrounding state (the lexical environment). In other words, a closure gives you access to an outer function’s scope from an inner function. In JavaScript, closures are created every time a function is created, at function creation time.

In other words, a closure is a function that has access to an outer function's scope.

What is scope?

Scope refers to the visibility of variables, functions, and objects in a particular piece of code during runtime. Scope can be divided into the global and local scope.

Global…


Just the basics

Even I, as a distinctly average (although somewhat aspirational) computer user, have heard terms like “RAM,” “hard drive,” “gigabyte,” “bit,” “memory,” but what does it all mean?

Memory and Hard Drive: What’s the Difference?

Computer memory is the system a computer uses to represent and store data for immediate use and is primarily made up of random-access memory (RAM). RAM contains data and instructions currently in use; that data is fast to access and is lost when the computer is turned off.

That’s where your hard drive comes in.

The bulk of the computer's data (programs, files, etc.) is stored on the hard drive. Data on the…


A beginner’s guide to assessing and describing algorithm run time.

You’ve started a course/book/class/whatever on data structures and algorithms, and your brain is melting. Before you can even get to the meat — or the mushroom — you’re hit with “big-o notation” this and “time/space complexity” that. Here’s my attempt to break it down into “I-don’t-have-a-computer-science-degree-or-a-math-brain” terms.

What the [insert expletive] is time complexity and big-O notation?

Time complexity is the amount of time taken for an algorithm to run as a function of the number of operations performed to complete the task. The fewer the number of operations, the more efficient the algorithm in terms of time complexity. …


You’ve used create-react-app to start your React project, and now you want to use an image tag in your project. There are a couple of ways of going about this.

  1. Import the image into the component

Firstly, you have to save the image somewhere in your src folder. Next, you need to import the image into the React component you’d like to use the image in. For example, a Logo.

import Logo from './path/logo.jpg'

In your image tag, you can now use this variable name are your src.

function Home() { return ( <div> <img src={Logo} alt="Company logo" /> </div>…


Download & install node.jshttps://nodejs.org/en/download/

Make your project directory. In your project directory add an index.js file

mkdir my-node-app
cd my-node-app
touch index.js

Initialize your node app.

npm init -y

Note: -y tag accepts the default criteria. Without it, you will be asked to make edits and accept criteria prior to initialization. Either way, the accepted information can be found in the package.json file and can be edited at any time.

Install Express.js

npm install express

Confirm express was installed by looking for it in the package.json file under dependencies.

touch .gitignore

To create a .gitignore file. Add node_modules…


What is React?

React is a framework for building single-page applications (SPAs). These applications will look as though there are multiple pages, but in reality, it’s a single page, with the conditional rendering of different components based on user interaction. These components are designed to look like new pages.

What is React-Router?

React-Router works by using the URL route to render components, e.g., /contact for the contact page, www.yourwebsite.com/contact resulting in the render of components that make up the contact page.

Getting started with React-Router

Install using npm:

npm install react-router-dom

Setup — index.js

In your index.js file, import BrowserRouter.


Photo by Aryan Dhiman on Unsplash

There’s nothing like starting a coding boot camp to finally confront the fact that, despite using a computer every day, that you might not be a particularly good computer user. At least that’s how Day One went for me.

Overall, there’s a lot to learn (it turns out they call it “boot camp” for a reason), so it can feel like a distraction to take the time to learn keyboard shortcuts, but trust me: it’s worth it in the long run!

Here are some VSCode (macOS) keyboard shortcuts to start with:

Copy a line: command+c (no selection necessary)

Cut a…

Paige Miles

Full-stack developer. Funny-peculiar. Lover of baking, yoga, and reading (between the lines).

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store