Javascript

Content about Javascript

How To Do Stacks In JavaScript

Introduction This is a series where you will learn about singly linked lists in JavaScript, doubly linked lists, stacks, and queues. The other links Are Here: How To Do Singly Linked Lists in JavaScript How To Do Stacks in JavaScript (This post) How To Do Doubly Linked Lists in JavaScript (Coming Soon) How To Do Queues in JavaScript (Coming Soon) What is a Stack? A stack is a abstract data structure that holds a list of components (such as a linked list of nodes). Think of it like a stack of dishes. You stack the dishes, so the last one...

Continue reading...

How To Do Singly Linked Lists in JavaScript

Introduction This is a series where you will learn about singly linked lists in JavaScript, doubly linked lists, stacks, and queues. The other links Are Here: How To Do Singly Linked Lists in JavaScript (This post) How To Do Stacks in JavaScript (Coming Soon) How To Do Doubly Linked Lists in JavaScript (Coming Soon) How To Do Queues in JavaScript (Coming Soon) What is a Linked List? A linked list is an abstract concept in which you have a “node” object that references the next object (which is a property within that node) and has a value property. The object...

Continue reading...

Promises In JavaScript: The Basics

A promise in JavaScript switches from synchronous to asynchronous JavaScript. Using this, we can continue running the rest of the code while we are doing something else. Usually you can do this with data fetching to show the information from the database later when the promise is finally finished. In this post, I will outline the basic concepts of promises in javascript. The basics: a promise. To understand the basics of promises in JavaScript, you must understand: a promise. What is a promise? A promise in an object that “promises” or “may” produce a value in the future (which could...

Continue reading...

How Everything in JavaScript Is an Object

Everything is an object in JavaScript. In this post, you will learn about how everything is an Object. As one would simply observe it’s not quite as simple as some claim it to be (yet it is simple in the concept). Finding Prototype Methods In JavaScript, everything is an object. Let’s create an array: This array has access to prototype methods. You can see this if you were arr.__proto__ in the console of your browser. You’ll get something like this: The prototype object in the prototype methods and values The array has access to the prototype object methods and properties....

Continue reading...

OOP VS FP Styles of Programming

OOP VS FP is a topic that has been going around for a while, in this blog post I hope to clear up what OOP is (object oriented programming) and what FP is (functional programming). There is a debate on which is better, OOP VS FP. This post hopes to clear up misunderstandings of either and educate a little bit more about the two. OOP – Object Oriented Programming What is it? Object Oriented Programming (OOP) is a style of programming in which uses classes, inheritance, etc. to keep it’s methods tied to an object. This style of programming makes...

Continue reading...

What are Closures in JavaScript?

Closures in JavaScript is where your function can “remember” the lexical scope — even when the function is ran outside of the scope. Instances of similar occurrences like this can be seen in Object Oriented Programming (OOP). In OOP, you can create an instance of the class object and access it. This functions in a similar way. This is called: Closures in JavaScript. First, let’s dive into what “lexical scope” is and the significance of its role in closures. Lexical Scope Scope is lexical, meaning it can be accessed only on the block of code in which it is defined....

Continue reading...

Callback Hell – What is it?

JavaScript Callback Hell is way too real. Your first question should be: “What is a callback?” as well as “What is Callback Hell?” — Both which are essential to understanding the problem that we encounter. What is a Callback? A callback is a function passed as a parameter to another function. Usually, there is not much problem with doing this a time (or two..). However, When we start nesting callbacks within callbacks, we get a boomerang of callbacks. Then we have: Callback Hell By nesting functions as parameters to other functions, you get something similar to this (shoutout to freecodecamp...

Continue reading...

for(;i–;) (JavaScript for loop explained)

This JavaScript for loop is something I came across the other day solving problems in LeetCode. What seemed like an easy problem was difficult as to understanding different ways to combine a set of stairs. Here’s a picture of the problem on LeetCode (the algorithm problem): Solving the for loop So, to solve something like this, there needed to be a form of loop as to the number of times, and then adding exponentially a number that counts the amount of times. So without going much further, here is a solution to this problem: Understanding the JavaScript loop versions So,...

Continue reading...

A Brief Origin Story of JavaScript

So for those of you who don’t know.. Here’s a short history on the brief origin story of JavaScript. It’s story time! The JavaScript Story: In 1995, JavaScript was written in just 10 days by a man with the name of: Brendan Eich. At the time, Brendan Eich was 34 years old, and he wrote JavaScript with Netscape. It was supposed to be a scripting language for use with the company’s flagship web browser, Netscape Navigator. Initially called LiveScript, it was the first programming language for the browser that allowed programs to run in the browser. There were many security...

Continue reading...

What is an Algorithm, and just.. why?

To start Let’s take a look at what an algorithm even is. By a quick search on https://google.com/ one can find this definition: So, therefore when using an algorithm, we go through a process: We have a real life problem Then input that data we have from the problem that will need transformed The algorithm does some sort of procedure with the information provided The output is returned with the intended values or set of values that the algorithm was designed to provide Okay, so why? The answer is part of the process: to solve computational problems that can be...

Continue reading...