Continuously you will need to know what type are the variables in order to create conditionals that are prepared to manipulate and maintain your code stable. For that reason I give you a cheat sheet to establish what is exactly your variable.

These are functions to which you pass your variable to indicate whether it is of a certain type or not.

Object

const myObject = {};

Array

const myArray = [];

Number, String…


Async/await was introduced in 2017 with ES8. It is a way to execute your code asynchronously without blocking the thread. Instead of using callbacks and promises the async/await syntax makes your code more readable and maintainable.

Creating an Async function

To create an async function we just need to add the async keyword before the function definition, like this:


I will list some quick facts and concepts you probably did not know about JS.

Type coercion

Type coercion is the process of converting value from one type to another. Since JavaScript is a weakly-typed language, it converts two different typed variables when you use its operators.

A great cheat sheet for the type coercion principles can be found here 👈 If you’re still wondering, the best practice is to not learn that whole table and stick with using strict comparison. REALLY.

Let’s get to some quick facts straight about operations.

Difference between == and ===

There a difference between using == and === when comparing two…


JavaScript has some useful string methods that are built into , I will share 5 methods that I find the most useful . I’ll quickly review some core concepts relating to strings.

String

In JavaScript, strings are any sequence of characters. When you use a string in JavaScript, it must be wrapped in single or double quotes, like this:

const greeting = 'Hello, how are you today?'
//or
const greeting2 = "Hey! What's up?"

Notice that in greeting2, there is a single quote in "What's". This is ok, because we wrapped it in double quotes, and one single quote isn't going…


In programming unintended side-effects called errors can and will happen in your code. Allowing these errors to be introduced to people that are using your programs is frowned upon and a very bad user experience.

Error Handling is the technique of smoothly handling these errors and providing useful information to a user.

Here are the important parts of error handling:Try

The try block allows you to try an initial blog of code.

async function doWork() {

To use Catch

To use the catch block allows you to…


A Doubly Linked List (DLL) is a linked data structure consists of a set of sequentially linked records called nodes which contains a lot of data elements and is even able to do a lot of operations such as insertion, delete, remove and add.

Start

Similar to a singly linked list, a doubly linked list is made up of a series of nodes. Each node contains some data as well as a pointer to the next node in the list and a pointer to the previous node. Here is a simple representation in JavaScript:

class DoublyLinkedListNode {
constructor(data)…

Array is a special variable that is use to store different elements, to get the most of it let’s take a look to some methods JavaScript offers us.

1. some()

This method tests the array with a function passed as a parameter. It will return true if at least one element matches the test and false for the opposite.

const myAwesomeArray = ["a", "b", "c", "d", "e"]

2. reduce()

This method receives a function which has an accumulator and a value as an argument. …


In this post I want to explain how to test most popular React Hooks using jest and enzyme.

To test react lifecycle, we need to use mount instead of using shallow.

useState

To test useState I created a small component with a title and a button to change that title.

function App() {
const [title, setTitle] = React.useState('');
return (
<div className="App">
<h1>{title}</h1>
<button
data-testid="AppButton"
onClick={() => setTitle('Another Title')}
>
Change Title
</button>
</div>
);
}

To test it, we just need to simulate a button click and then see if the text is correctly updated. To simulate this click we…


CRUD Operation?

The acronym CRUD stands for Create, Read, Update and Delete.

Create: Inserts a new data
Read: Read the data
Update: Update the existing data
Delete: Delete the existing data

List of HTTP Request methods

GET — is used to request data from a specified resource.
POST — is used to send data to a server to create a resource.
PUT — is used to send data to a server to update a resource.
DELETE — is used to delete the specified resource.

REST API Server ?

If you’re performing CRUD operation using Fetch API you’re going to need a REST API server.

JSONPlaceholder is a free online REST API…


Heroku account

1) Here’s the link: https://signup.heroku.com/

2) You’ll be creating a new app and adding your app’s name and region.

Heroku Set up

1) Install Heroku CLI. On a Mac, if you have homebrew, run brew tap heroku/brew && brew install heroku in the terminal, otherwise check out the documentation.

2) In the root directory of your backend, run heroku login and login as prompted.

3) Also in the root directory of your backend Rails application, if it’s already a git repository, run heroku git:remote -a <app_name>. The app name must be the same as the name you used on Heroku.

Swtich SQLite3 default database to PostreSQL

Note: If you’ve…

Zara Ahmadi

Software Engineering student @Flatiron

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