
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Found 6710 Articles for Javascript

15K+ Views
Creating custom sort functions in JavaScript can be a great way to customize and optimize your sorting process. By defining a custom sort function, you are able to control the specific order that elements of an array will be sorted in. This article will explain how to define a custom sort function in JavaScript, provide examples of when it is useful and discuss several tips on how to make sure your sorting process is as efficient as possible. Typically, this method alters the initial array by shifting certain elements. Additionally, the sort() method converts the elements of the input ... Read More

662 Views
JavaScript is a popular scripting language used to create interactive websites and applications. It has many powerful features that make it easy to use and extendable. This can be useful for validating user input on forms or other data-driven tasks where you want to ensure the user enters a value within a specific range. In this article, we will discuss how to accept only numbers between 0 and 255 range using JavaScript. The range function in JavaScript returns a list of all the integers after receiving the beginning and ending indexes. The difference between the lowest and ... Read More

2K+ Views
The task we are going to perform in this article, is “Convert set to object”. Before we jump into the article, let’s have quick view on the sets and objects in JavaScript. A collection of distinctive values makes up a JavaScript Set. In a Set, a value can only appear once. Any value of any data type can be stored in a set. An object in JavaScript is a separate entity having properties and a type. Consider comparing it to a cup. A cup is an item with characteristics. A cup has a design, weight, color, material, and other ... Read More

205 Views
To validate a specific URL, use regular expression.ExampleThe code is as follows −function validateSoundURL(myURL) { var regularExpression = /^https?:\/\/(tutorialspoint\.com)\/(.*)$/; return myURL.match(regularExpression) && myURL.match(regularExpression)[2] } console.log(validateSoundURL("https://tutorialspoint.com/index")); console.log(validateSoundURL("https://tutorialspoint.com/java"));To run the above program, you need to use the following command −node fileName.js.Here, my file name is demo259.js.OutputThis will produce the following output on console −PS C:\Users\Amit\javascript-code> node demo259.js index java

13K+ Views
JavaScript Get href Value is a useful tool for web developers and designers who need to quickly access the value of an HTML element's href attribute. This article will provide step-by-step instructions on how to use JavaScript to get the value of an href attribute on a webpage, as well as some tips and tricks for getting the most out of this powerful feature. The ability to quickly obtain the values from an HTML element's attributes can help make development faster and more efficient, so let's get started! The value of the href attribute in JavaScript is a URL ... Read More

972 Views
This article will explain how to use the JavaScript string method 'replace()' to delete all text up to a character in a URL. We'll walk through an example of how this technique can be used for cutting off unnecessary information from a URL, and provide some helpful tips on when you might want to use this approach. A character pattern is what makes up a regular expression. The pattern is applied to text to perform "search-and-replace" operations that match patterns. A RegExp Object in JavaScript is a pattern with properties and methods. The replace() in JavaScript The replace() method ... Read More

1K+ Views
The ability to multiply only specific values in a JavaScript object can be a useful tool for performing calculations or making modifications to data. By using the map() and reduce() methods, you can quickly go through an entire object and make changes to any value that meets certain criteria. This article will provide an overview of how this process works as well as offer some examples of how it can be used in practice. An object in JavaScript is a separate entity having properties and a type. Example In the following example, we are running the script where ... Read More

1K+ Views
Adding a new CSS rule can help to create the desired look and feel for your web page or application. This article will explain how to insert a new CSS rule while working on JavaScript. It will provide step-by-step instructions on how to write and apply the necessary code in order to achieve the desired result. Additionally, we will also discuss some of the potential problems that may arise when inserting a new CSS rule into an existing project. The style sheet language known as CSS (cascading style sheets), is used to shape the HTML elements that will be ... Read More

3K+ Views
Regex (or Regular Expressions) is used to match patterns in strings of text. With JavaScript, you can use regex to dynamically replace data based on matched patterns. This article will explain how to use regex and JavaScript together to make dynamic replacements in your code. We'll cover the basics of regex syntax, regular expression objects, and methods for using them with JavaScript. JavaScript offers various data types to store various types of values. Because the JavaScript engine uses variables in a dynamic manner, it is not necessary to specify the type of a variable when using JavaScript. Here, the ... Read More

2K+ Views
Are you looking for ways to convert an integer to binary in JavaScript? If so, this article is for you! In this article, we will discuss the various methods available for converting an integer into its binary equivalent using JavaScript. We’ll look at how a number can be broken down into individual bits and manipulated accordingly. Converting an integer to binary is simply changing the integer value into a binary value. For example, assume we have passed two integer values, 22 and 45, respectively, as: var x = 22; var y = 45; Now, if we perform ... Read More