Check out all our Tutorial Series ->

Tutorial Series

How To Code in JavaScript

How To Code in JavaScript

Introduction

JavaScript is a high-level, object-based, dynamic scripting language popular as a tool for making webpages interactive.

Summary View
detailed View

Series Tutorials

Tutorial

This tutorial will go over how to work with the Console in JavaScript within the context of a browser, and provide an overview of other built-in development tools you may use as part of your web development process.

Tutorial

How To Add JavaScript to HTML

Updated on April 15, 2024

This tutorial will go over how to incorporate JavaScript into your web files, both inline into an HTML document and as a separate file.

Tutorial

This tutorial will walk you through creating a “Hello, World!” program in JavaScript. To make the program more interesting, we’ll modify the traditional “Hello, World!” program so that it asks the user for their name. We’ll then use the name in a greeting. When you’re done with this tutorial, you’ll have an interactive “Hello, World!” program.

Tutorial

In this tutorial, we’ll go over many of the rules and conventions of JavaScript syntax and code structure.

Tutorial

How To Write Comments in JavaScript

Updated on August 30, 2021

JavaScript comments are annotations in the source code of a program that are ignored by the interpreter, and therefore have no effect on the actual output of the code. Comments can be immensely helpful in explaining the intent of what your code is or should be doing.

Tutorial

Understanding Data Types in JavaScript

Updated on August 23, 2021

In this tutorial, we will go over how data types work in JavaScript as well as the important data types native to the language.

Tutorial

How To Work with Strings in JavaScript

Updated on August 24, 2021

A string is a sequence of one or more characters that may consist of letters, numbers, or symbols. Strings in JavaScript are primitive data types and immutable, which means they are unchanging. As strings are the way we display and work with text, and text is our main…

Tutorial

In this tutorial, we will learn the difference between string primitives and the String object, how strings are indexed, how to access characters in a string, and common properties and methods used on strings.

Tutorial

How To Convert Data Types in JavaScript

Updated on August 24, 2021

This tutorial will guide you through converting JavaScript’s primitive data types, including numbers, strings, and Booleans.

Tutorial

This tutorial covers what variables are, how to declare and name them, and also take a closer look at the difference between var, let, and const. It also goes over the effects of hoisting and the significance of global and local scope to a variable’s behavior.

Tutorial

In this JavaScript tutorial, we will go over arithmetic operators, assignment operators, and the order of operations used with number data types.

Tutorial

The field of computer science has many foundations in mathematical logic. If you have a familiarity with logic, you know that it involves truth tables, Boolean algebra, and comparisons to determine equality or difference. The JavaScript programming language uses operators…

Tutorial

Understanding Arrays in JavaScript

Updated on August 24, 2021

In this tutorial, we will learn how to create arrays; how they are indexed; how to add, modify, remove, or access items in an array; and how to loop through arrays.

Tutorial

JavaScript has many useful built-in methods to work with arrays. Methods that modify the original array are known as mutator methods, and methods that return a new value or representation are known as accessor methods. In this tutorial, we will focus on mutator methods.

Tutorial

This tutorial will go over methods that will concatenate arrays, convert arrays to strings, copy portions of an array to a new array, and find the indices of arrays.

Tutorial

In JavaScript, the array data type consists of a list of elements. There are many useful built-in methods available for JavaScript developers to work with arrays. In this tutorial, we will use iteration methods to loop through arrays, perform functions on each item in an array, filter the desired results of an array, reduce array items down to a single value, and search through arrays to find values or indices.

Tutorial

Understanding Objects in JavaScript

Updated on August 25, 2021

Objects are an integral and foundational aspect of most JavaScript programs. For example, a user account object may contain such data as usernames, passwords, and e-mail addresses. Another common use case is a web shopping platform’s shopping cart that could consist of an array of many objects containing all the pertinent information for each item, such as name, price, and weight for shipping information. A to-do list is another common application that might consist of objects.

Tutorial

JavaScript comes with the built in Date object and related methods. This tutorial will go over how to format and use date and time in JavaScript.

Tutorial

Understanding Events in JavaScript

Updated on August 25, 2021

Events are actions that take place in the browser that can be initiated by either the user or the browser itself. In this JavaScript aticle, we will go over event handlers, event listeners, and event objects. We’ll also go over three different ways to write code to handle events, and a few of the most common events. By learning about events, you’ll be able to make a more interactive web experience for end users.

Tutorial

How To Work with JSON in JavaScript

Updated on August 25, 2021

This tutorial provides an introduction to working with JSON in JavaScript. Some general use cases of JSON include: storing data, generating data from user input, transferring data from server to client and vice versa, configuring and verifying data.

Tutorial

In programming, there will be many occasions in which you will want different blocks of code to run depending on user input or other factors. As an example, you might want a form to submit if each field is filled out properly, but you might want to prevent that form from…

Tutorial

Conditional statements are among the most useful and common features of all programming languages. “How To Write Conditional Statements in JavaScript” describes how to use the…

Tutorial

Automation is the technique of making a system operate automatically; in programming, we use loops to automate repetitious tasks. Loops are one of the most useful features of programming languages, and in this this article we will learn about the while and do…while…

Tutorial

JavaScript For Loops

Updated on August 26, 2021

Loops are used in programming to automate repetitive tasks. In this tutorial, we will learn about the for statement, including the for…of and for…in statements, which are essential elements of the JavaScript programming language.

Tutorial

How To Define Functions in JavaScript

Updated on August 26, 2021

A function is a block of code that performs an action or returns a value. Functions are custom code defined by programmers that are reusable, and can therefore make your programs more modular and efficient. In this tutorial, we will learn several ways to define a…

Tutorial

JavaScript is a prototype-based language, meaning object properties and methods can be shared through generalized objects that have the ability to be cloned and extended. This is known as prototypical inheritance and differs from class inheritance. Among popular…

Tutorial

Understanding Classes in JavaScript

Updated on August 26, 2021

Understanding prototypical inheritance is paramount to being an effective JavaScript developer. Being familiar with classes is extremely helpful, as popular JavaScript libraries such as React make frequent use of the class syntax.

Tutorial

How To Use Object Methods in JavaScript

Updated on August 26, 2021

Objects in JavaScript are collections of key/value pairs. The values can consist of properties and methods, and may contain all other JavaScript data types, such as strings,…

Conceptual-article

The this keyword is a very important concept in JavaScript, and also a particularly confusing one to both new developers and those who have experience in other programming languages. In JavaScript, this is a reference to an object. In this article, you’ll learn what this refers to based on context, and you’ll learn how you can use the bind, call, and apply methods to explicitly determine the value of this.

Tutorial

Introduced in ECMAScript 2015, Maps in JavaScript are ordered collections of key/value pairs, and Sets are collections of unique values. In this article, you will go over the Map and Set objects, what makes them similar or different to Objects and Arrays, the properties and methods available to them, and examples of some practical uses.

Tutorial

Understanding Generators in JavaScript

Updated on August 27, 2021

In ECMAScript 2015, generators were introduced to the JavaScript language. A generator is a process that can be paused and resumed and can yield multiple values. They can maintain state, providing an efficient way to make iterators, and are capable of dealing with infinite data streams. In this article, we’ll cover how to create generator functions, how to iterate over Generator objects, the difference between yield and return inside a generator, and other aspects of working with generators.

Tutorial

In ECMAScript 2015, default function parameters were introduced to the JavaScript programming language. These allow developers to initialize a function with default values if the arguments are not supplied to the function call. Initializing function parameters in this way will make your functions easier to read and help you avoid errors caused by undefined arguments and the destructuring of objects that don’t exist. In this article, you will learn how to use default parameters.

Tutorial

Introduced in ECMAScript 2015 (ES6), destructuring, rest parameters, and spread syntax provide more direct ways of accessing the members of an array or an object, and can make working with data structures quicker and more succinct. In this article, you will learn how to destructure objects and arrays in JavaScript, how to use the spread operator to unpack objects and arrays, and how to use rest parameters in function calls.

Tutorial

The 2015 edition of the ECMAScript specification (ES6) added template literals to the JavaScript language. Template literals are a new form of making strings in JavaScript that add a lot of powerful new capabilities, such as creating multi-line strings, using placeholders to embed expressions in a string, and parsing dynamic string expressions with tagged template literals. In this article, you will go over the differences between single/double-quoted strings and template literals.

Tutorial

Arrow functions are a new way to write anonymous function expressions in JavaScript, and are similar to lambda functions in some other programming languages like Python. They differ from traditional functions in the way their scope is determined and how their syntax is expressed, and are particularly useful when passing a function as a parameter to a higher-order function, like an array iterator method. In this article, you will find examples of arrow function behavior and syntax.

Tutorial

In order to avoid blocking code in JavaScript development, asynchronous coding techniques must be used for operations that take a long time, such as network requests made from Web APIs like Fetch. This article will cover asynchronous programming fundamentals, teaching you about the event loop, the original way of dealing with asynchronous behavior through callbacks, the updated ECMAScript 2015 (ES6) addition of promises, and the modern practice of using async/await.

Tutorial

As the importance of JavaScript in web development grows, there is a bigger need to use third-party code for common tasks, to break up code into modular files, and to avoid polluting the global namespace. To account for this, ECMAScript 2015 (ES6) introduced modules to the JavaScript language, which allowed for the use of import and export statements. In this tutorial, you will learn what a JavaScript module is and how to use import and export to organize your code.

Check out all our Tutorial Series

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Featured on Community

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
Animation showing a Droplet being created in the DigitalOcean Cloud console