Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Javascript Articles
Page 295 of 534
How to append an item into a JavaScript array?
To append an item to a JavaScript array, you can use several methods. The most common approach is the push() method, which adds elements to the end of an array. Using push() Method The push() method adds one or more elements to the end of an array and returns the new length: var arr = ["marketing", "technical", "finance", "sales"]; arr.push("HR"); ...
Read MoreAlign the text of a document with CSS
The text-align property in CSS is used to align the text content within an element. It accepts several values: left (default), right, center, and justify. Syntax text-align: left | right | center | justify; Values left: Aligns text to the left edge (default) right: Aligns text to the right edge center: Centers the text horizontally justify: Spreads text evenly across the width, aligning both left and right edges Example Here's how to use different text alignment values: ...
Read MoreHow to create a zero-filled JavaScript array?
To create a zero-filled JavaScript array, you have several methods available. The most common approaches include using Array.fill(), Array.from(), or typed arrays like Uint8Array. Using Array.fill() Method The Array.fill() method is the most straightforward way to create a zero-filled array: // Create array of length 5 filled with zeros var zeroArray = new Array(5).fill(0); document.write("Zero-filled array: " ...
Read MoreAdd or subtract space between the words of a sentence with CSS
The word-spacing property is used to add or subtract space between the words of a sentence. Possible values are normal or a number specifying space. Syntax word-spacing: normal | length | initial | inherit; Parameters Value Description normal Default spacing between words length ...
Read MoreHow to convert an array into JavaScript string?
An array is the most popular and adaptable data structure you might employ in your regular programming. Converting an array into a JavaScript String can be done using several predefined methods and techniques. Using the toString() Method Using the join() Method Using JSON.stringify() Method Using Type Coercion Using the toString() Method The toString() method is a built-in JavaScript function that converts array elements into a comma-separated string. It's the simplest way to convert an array to string format. ...
Read MoreHow to add an element in the last of a JavaScript array?
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 end of the array is by using the Array push() method, but we will discuss multiple methods to achieve this. Using the Array.prototype.push() Method Using the Array.prototype.splice() Method Using Array Indexing Using the Array.prototype.push() Method To add an element at the end, use the JavaScript push() method. The push() method appends the given element(s) to the end of the array and ...
Read MoreHow to serialize a JavaScript array?
In JavaScript, serializing an array means converting it into a string format that can be stored, transmitted, or reconstructed later. While jQuery's serializeArray() method is useful for form data, JavaScript provides native methods for general array serialization. What is Array Serialization? Array serialization converts a JavaScript array into a string representation. The most common approach uses JSON.stringify() to convert arrays into JSON strings, which can be easily transmitted to servers or stored in local storage. Using JSON.stringify() (Recommended) The JSON.stringify() method is the standard way to serialize JavaScript arrays: // Simple array serialization let ...
Read MoreUnderline text with CSS
Use the text-decoration property to underline text with CSS. This property provides several options for decorating text, with underline being one of the most commonly used values. Syntax text-decoration: underline; Basic Example India Different Underline Styles You can customize the underline appearance using additional properties: ...
Read MoreHow to extract the number of minutes from current time in JavaScript?
JavaScript uses timestamps based on Unix time (milliseconds since January 1, 1970 UTC) to handle dates and times. While humans understand time in hours and minutes, JavaScript provides built-in methods to extract specific time components from Date objects. In this tutorial, we will learn how to extract the number of minutes from the current time in JavaScript using the getMinutes() method. Date Object Methods The JavaScript Date object provides several methods to extract time components: getHours() − Returns the current hour (0-23) in 24-hour format getMinutes() − Returns the current minutes (0-59) getSeconds() − Returns ...
Read MoreStrikethrough text with CSS
Use the text-decoration property to create strikethrough text with CSS. The line-through value draws a horizontal line through the middle of the text. Syntax text-decoration: line-through; Basic Example This text will be striked through. Using CSS Classes For better organization, use CSS classes instead of inline styles: ...
Read More