Javascript

How to use the endsWith method in JavaScript

In this short tutorial, we are going to see what the endsWith method, introduced in JavaScript ES6, is and how it is used with strings in JavaScript. The endsWith method is used to find out if a string ends with the character or substring you pass as a parameter to the…

Category : Javascript   21-12-2022   by Janeth Kent

What are javascript symbols and how can they help you?

Symbols are a new primitive value introduced by ES6. Their purpose is to provide us unique identifiers. In this article, we tell you how they work, in which way they are used with JavaScript and how they can help us. How to create symbols To create a new symbol we will have…

Category : Javascript   20-12-2022   by Janeth Kent

Callbacks in JavaScript

Callback functions are the same old JavaScript functions. They have no special syntax, as they are simply functions that are passed as an argument to another function. The function that receives the callback as an argument is called a higher-order function. Any function can be used as a callback, since it is…

Category : Javascript   19-12-2022   by Janeth Kent

How to create PDF with JavaScript and jsPDF

Creating dynamic PDF files directly in the browser is possible thanks to the jsPDF JavaScript library. In the last part of this article we have prepared a practical tutorial where I show you how to implement the library. Below you can see the completed exercise. The client side is gaining ground over…

Category : Javascript   04-12-2022   by Janeth Kent

Amazing Javascript Game Source Codes for Free

In this article we will share the code to make simple games with Javascript programming language. The games code can later be your reference material for making other simple games. Before you continue do you already know what is javascript programming ?, if you don't know yet, please read the brief…

Category : Javascript   19-07-2022   by Luigi Nori

import one JS file into another in the plain JS

Until some years ago, it was not possible to import one js file or block of code from one file into another but since 2015, ES6 has introduced useful ES6 modules. With the modulestandard, we can use importand exportkeyword and syntax given to include and export the module in JS…

Category : Javascript   03-12-2021   by Luigi Nori

Node.js and npm: introductory tutorial

In this tutorial we will see how to install and use both Node.js and the npm package manager. In addition, we will also create a small sample application. If you have ever used or thought about using a JavaScript-based development tool, you have probably noticed that you need to install…

Category : Javascript   05-11-2021   by Silvia Mazzetta

How to connect to MySQL with Node.js

Let's see how you can connect to a MySQL database using Node.js, the popular JavaScript runtime environment. Before we start, it is important to note that you must have Node.js installed on your system. Likewise, you must create a MySQL database.   Create a MySQL database   If you haven't already done so, you can…

Category : Javascript   04-11-2021   by Silvia Mazzetta

JavaScript Programming Styles: Best Practices

When programming with JavaScript there are certain conventions that you should apply, especially when working in a team environment. In fact, it is common to have meetings to discuss standards to follow. The reason is that code is much more readable when certain standards are followed. We have already seen…

Category : Javascript   28-10-2021   by Janeth Kent

First steps into JavaScript – a practical guide 2

In the previous aticleFirst steps into JavaScript – a practical guidewe covered the basics of the DOM and its relation to us becoming JS literate. Now that we know how to access DOM elements, we can continue with learning how to change them. But before we start, let's make sure we…

Category : Javascript   26-10-2021   by Iveta Karailievova

First steps into JavaScript – a practical guide

For those who are new to web development, surely the amount of new terminology can sometimes be discouraging. But when it comes to learning JS, some of the first new concepts you definitively should wrap your head around is the Document Object Model and what it implies. To keep it simple…

Category : Javascript   26-10-2021   by Iveta Karailievova

JavaScript Arrow functions: What they are and how to use them

In this article we are going to see what they are and how to use JavaScript Arrow Functions, a new feature introduced with the ES6 standard (ECMAScript 6). What are Arrow Functions Arrow Functions are a new syntax for defining anonymous functions in JavaScript in a more concise way. Being an abbreviated…

Category : Javascript   30-08-2021   by Janeth Kent

Difference between arrow and normal functions in JavaScript

In this tutorial we are going to see how arrow functions differ from normal JavaScript functions. We will also see when you should use one and when you should use the other.   Normal functions   JavaScript's standard functions, those we call normal or standard functions, have been included in JavaScript since its inception.…

Category : Javascript   30-08-2021   by Janeth Kent

How to insert an element into an array with JavaScript

In this brief tutorial you will learn how to insert one or more elements into an array with JavaScript. For this we will use the splice function. The splice function will not create a new array when used, but will modify the existing array. The syntax of the splice function, included in…

Category : Javascript   20-08-2021   by Janeth Kent

What is the difference between primitives types and objects in JavaScript?

In this short tutorial we are going to look at the differences between primitive types and objects in JavaScript. To start with, we're going to look at what primitive types are. Then we will see what objects are and how they differ.   Introduction   The primitive types in JavaScript are as follows:   Boolean: 'boolean String:…

Category : Javascript   16-08-2021   by Silvia Mazzetta

How synchronize the scroll of two divs with JavaScript

In case you have two divs of different sizes you may sometimes want to scroll both at the same time but at different speeds depending on their size. For example, you could have text in one and images in the other and want to scroll both at the same time.…

Category : Javascript   11-08-2021   by Silvia Mazzetta

How to reverse an array in JavaScript

In this tutorial we are going to see how you can change the order of the elements of an array so that they are inverted. You could use a loop and reverse the array manually, but as we will see, in JavaScript there are much faster ways to achieve our…

Category : Javascript   11-08-2021   by Janeth Kent

How to get DOM elements with JavaScript

When you access any element of the DOM, it is usual to save it in a variable. This is something that at first might seem very simple, but if you are a beginner programmer it might give you some headaches sometimes. To begin with, let's see how you can get an…

Category : Javascript   11-08-2021   by Silvia Mazzetta

Best Open-Source Javascript Date Picker Plugins and Libraries

For date pickers, selecting menus is a common choice as they are simple to set up. But I suppose our customers deserve better after centuries of using MM / DD / YY menus. For many companies, datepickers are vital. They can also be used for any defined purpose to monitor time. It…

Category : Javascript   23-07-2021   by Janeth Kent

How to use the codePointAt method in JavaScript

The JavaScript codePointAt method has more or less the same function as the charCodeAt method, used to get the 16-bit Unicode representation of the character at a certain position in a string. However, certain characters present a small problem, as they use two 16-bit units, so the charCodeAt method will only…

Category : Javascript   23-07-2021   by Janeth Kent

How to use the charCodeAt method in JavaScript

The charCodeAt method is accepted by strings in JavaScript, returning the 16-bit Unicode code of the character at the position we pass as a parameter to the method. The charCodeAt method can be used with both standard strings defined with single or double quotes and String objects or literal templates. In this…

Category : Javascript   22-07-2021   by Janeth Kent

How to use the charAt method in JavaScript

The charAt method is accepted by strings in JavaScript, returning the position of the character passed as a parameter within the string. If the string contains multiple occurrences of the character passed as a parameter, the charAt method will return only the position of the first occurrence. If the character is…

Category : Javascript   22-07-2021   by Janeth Kent

How to check if a value is a number in JavaScript

In this short tutorial we are going to look at the various methods that exist to find out if a value is a number in JavaScript.   1. Using the isNaN() function   One of the most commonly used methods is to use the isNaN() function, which is a global function assigned to the…

Category : Javascript   22-07-2021   by Janeth Kent

Strings in JavaScript: What they are and how to use them

In this tutorial we are going to explain what strings are and how they are used in JavaScript. The tutorial is intended for people who are learning to program in JavaScript. You will learn how to create strings, how to display the content of strings, how to concatenate strings and…

Category : Javascript   22-06-2021   by Janeth Kent

Formatting hours in Javascript

Continuing with the set of articles that talk about internationalisation elements, like the previous one where we talked about relative dates in JavaScript, we will see in this one how to format hours in JavaScript. The first thing we need to do is to create an 'hour' in JavaScript. That is,…

Category : Javascript   10-06-2021   by Janeth Kent

Dates in local format with Javascript

In the articles we have about dates in JavaScript we were missing one about how to create dates in local format with JavaScript. That is to say, being able to internationalise (i18n) the date before printing it. Many of you may be saying, "we have already seen this using the…

Category : Javascript   10-06-2021   by Janeth Kent

Request data with prompt in JavaScript

After having published several articles about how to manipulate arrays and dates, today I will publish a post that some of you will find too basic and others will find it useful to get you started in the world of JavaScript programming. So, let them be read to the taste…

Category : Javascript   01-06-2021   by Janeth Kent

Relative dates in JavaScript

One of the interesting things about the internationalisation library represented in the Int object is the handling of relative dates in Javascript. This handling allows us to represent a date according to relative elements, that is to say, to be able to specify which was yesterday, or the day before…

Category : Javascript   25-05-2021   by Janeth Kent

The JavaScript forEach loop

We have already talked about how to handle some of loops  types in Javascript including for, for-in and for-off loops. In the case of today we are going to see how we can make a foreach loop in Javascript. A foreach loop helps us in a simple way to go through the…

Category : Javascript   20-05-2021   by Janeth Kent

How to access webcam and grab an image using HTML5 and Javascript

We often use webcams to broadcast video in real time via our computer. This broadcast can be viewed, saved and even shared via the Internet. As a rule, we need software to access the webcam and stream video. But you can also stream video on websites without using third-party software. The…

Category : Javascript   20-05-2021   by Janeth Kent

page=