Code

General Code

Creating a Promise

Promises are used for asynchronous code. It is a temporary holder for a value that gets returned by an asynchronous call. For example, a call to a web service might use a promise. You can call the web service with a promise and once it is fulfilled, you can run some code. Here is the […]

Creating a Promise Read More »

Developer Defined Errors

We can also throw our own errors. This is done with the “throw” keyword using the “new” keyword and the Error method. Here is the syntax… Why would we do this? There might be times when your code logic won’t throw a JavaScript error, but something happens that you want to catch so no issues

Developer Defined Errors Read More »

Finally

We can add another block to try/catch. This is done with the “finally” keyword. What the finally code block does is run always. So even if there is an error, the finally block still runs. It runs regardless if there is an error or not. Here is the syntax… Happy Coding! Clay Hess

Finally Read More »