Found 8895 Articles for Front End Technology

How to get current date and time using JavaScript?

V Jyothi
Updated on 18-Jun-2020 08:36:06

405 Views

To get current date and time using JavaScript, use the Date() method. JavaScript Date() method returns today's date and time and does not need any object to be called.ExampleYou can try to run the following code to get current date and time −Live Demo           JavaScript Date Method                        var dt = Date();          document.write("Date and Time : " + dt );           OutputDate and Time : Mon May 28 2018 10:16:33 GMT+0530 (India Standard Time)

How to extract the number of minutes from current time in JavaScript?

Shubham Vora
Updated on 23-Aug-2022 09:24:30

2K+ Views

We humans can understand how the date and time are divided and printed. On theother hand, JavaScript interprets the date based on a timestamp generated from Unix time, which is a value made up of milliseconds. JavaScript Platform-independent date objects represent a single point in time. A millisecond counter has been included in Date objects since January 1, 1970 UTC. YYYY-MM-DD is the most used JavaScript date format. Timed Dates YYYY-MM-D DTHH:MM:SSZ. A date data type is not available in JavaScript. Dates can be set, obtained, and changed using various methods provided on the Date object in JavaScript. In ... Read More

How to add new value to an existing array in JavaScript?

Saurabh Jaiswal
Updated on 06-Jan-2023 13:05:21

3K+ Views

In programming, it is very common to add new value to an existing array whether you are building a small or high-level application, whenever we need to extend the number of items in an array we use it to add new value in the array. In this article, we will be learning multiple ways to add new values in an array which are the following. Using the Array.push() method. Using the Array.unshift() method. Using the Array.splice() method. Using the spread operator. Using the Array.push() method The Array.push() method is the most used method to add any value at ... Read More

How to serialize a JavaScript array?

Prabhdeep Singh
Updated on 07-Nov-2022 08:20:39

2K+ Views

In this tutorial, we are going to learn to serialize JavaScript arrays. The serializeArray() method serializes all forms and forms elements like the .serialize() method but returns a JSON data structure for you to work with. A JavaScript array of objects may be created using the built-in jQuery function serializeArray() that is ready to be encoded as a JSON string. It utilizes a set of forms and/or form controls from jQuery. There are several sorts of controls. Any JavaScript object may be converted into JSON using a JSON string, which can then be sent to the server. Syntax Now let’s ... Read More

How to remove last array element in JavaScript and return it?

Shubham Vora
Updated on 26-Aug-2022 14:17:28

15K+ Views

In this tutorial, we will learn how to remove the last array element in JavaScript and return it. In JavaScript, arrays are described as list-like objects. A single array object can store multiple values. An array object is stored in a variable. Array elements are stored in a memory location. Each array element is identified by its index value. You must process an array by inserting an element, removing or changing, etc. JavaScript has a lot of methods to update an array. Let us look at various ways to remove the last array element in JavaScript. Following are the Methods/Functions ... Read More

How to reverse the order of a JavaScript array?

Abhinanda Shri
Updated on 18-Jun-2020 08:18:32

256 Views

To reverse the order of a JavaScript array, use the JavaScript array() method. JavaScript array reverse() method reverses the elements of an array. The first array element becomes the last and the last becomes the first.ExampleYou can try to run the following code to reverse the order of a JavaScript array −           JavaScript Array reverse Method                        var arr = c.reverse();          document.write("Reversed array is : " + arr );          

How to add an element in the last of a JavaScript array?

Saurabh Jaiswal
Updated on 22-Aug-2022 07:51:19

5K+ Views

In this tutorial, we will learn how to add an element to the last of a JavaScript array. The most common method to add an element to the last of the array is by using the Array push() method but we will discuss multiple methods by which we can achieve this. Here are some approaches to achieve this. Using the Array.prototype.push( ) Method Using the Array.prototype.splice( ) Method Using the Array Indexing Using the Array.prototype.push() Method To add an element in the last, use the JavaScript push() method. JavaScript array push() method appends the given element(s) in the ... Read More

How to convert an array into JavaScript string?

Shubham Vora
Updated on 22-Aug-2022 08:43:41

8K+ Views

An array is the most popular and adaptable data structure you might employ in your regular programming. Predefined methods and a few more techniques make converting an array into a string simple. The process of converting an array into a JavaScript String can be done in several methods, and in this article, we will be looking at them. Using the toString() Method Using the join() Method Using JSON.stringify() Method Using the Type Coercion Using the toString() Method There is an internal function toString(). It is a built-in JavaScript method that can be applied to any JavaScript variable. The ... Read More

How to find the length of an array in JavaScript?

Abhishek
Updated on 31-Oct-2022 07:58:20

13K+ Views

In this tutorial, we will learn about the method of finding the length of an array in JavaScript. The length of an array is the number of elements or items contained by a JavaScript array. In JavaScript, we have only one way or method to find out the length of an array. Using the length property Using the length property In JavaScript, we are allowed to use the length property of JavaScript for finding the length of an array. As we know the length of an array is the number of elements contained by the array, the length ... Read More

How to create a zero-filled JavaScript array?

Ramu Prasad
Updated on 13-Jan-2020 10:28:00

78 Views

To create a zero-filled JavaScript array, use the Unit8Array typed array.ExampleYou can try to run the following code:Live Demo                    var arr1 = ["marketing", "technical", "finance", "sales"];          var arr2 = new Uint8Array(4);          document.write(arr1);          document.write("Zero filled array: "+arr2);          

Advertisements