- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- 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 7020 Articles for Javascript

97 Views
In this article, we are going to learn about the methods of sorting a numerical array in JavaScript. Sorting of an array means to arrange the elements of an array in a particular order i.e. they can be in ascending or the increasing order and they can be arranged in descending or the decreasing order. There are two ways in which we can sort a numeric array in a particular order in JavaScript − By traversing array with the help of loops By using the sort() method available in JavaScript Let us discuss both of the above methods ... Read More

33 Views
Generally, we sort arrays, objects and some other data types using some method of JavaScript. But, in this article, we are going to sort the child elements of an element whose values are in unsorted order using the data attribute of those child elements. In this article, we are going to learn about the two different ways or methods of sorting the child elements according to the value of their data attribute given to them. The methods we use to sort are listed below − By selecting the value of data attribute using the getAttribute() method. By selecting the ... Read More

50 Views
A array with multiple columns is an array that contains multiple elements at single index or position OR we can say that it is an array of arrays that contains multiple arrays at each index of it and we have to sort that array according to the elements of those contained arrays. In this article, we are going to learn about the method of sorting an array of arrays with the help of sort() method. We will use the comparator function to compare the elements of inner arrays with each other and sort them accordingly. Let us see how we ... Read More

27 Views
An array of objects is an array that contains all the elements in the form of JavaScript objects. Here, we are said to use an array of objects with two fields that means, have to use objects with two elements as elements of the array. In this article, we are going to learn about the method of sorting the array of objects by two fields in JavaScript. We can simply use the sort() method of JavaScript to sort the elements of an array and give it a cmp or the comparator function to define the order in which we want ... Read More

26 Views
A set is also a data structure that is almost similar to the map data structure. The only difference between them is that map stores the elements in the form of key-value pair, while set does not it only stores a single value in the same order as it was inserted. It can also store primitive data types as well as objects as map does. A set contains all the elements in the same order as they are inserted. But, we can sort a set in any order whether in increasing or decreasing order of elements using the sort() method ... Read More

27 Views
In JavaScript, Map is a type of data structure that stores the values in the form of key value pairs. It can store all types of data types, whether they are primitive or JavaScript objects. It stores the elements in the same order in which they are inserted, hence, when we iterate through its elements, it prints the elements in the same order as we have stored them. As we have discussed that the order of elements stored in a Map is same as we insert elements in that Map. But, we can also sort the elements of the map ... Read More

19 Views
The performance.now() method is used to calculate the performance of the code written by any programmer or the coder. The performance.now() method will return a numerical value that will be the time taken by the written code to execute. The value returned by this method may vary every time we execute the code even for the same code. In today’s time, everyone wants to write the fast loading and the efficient code for a problem that can work on every parameter and fastest of all other solutions. So, to measure the efficiency and to make sure that the written code ... Read More

175 Views
What is JQuery? JQuery is a JavaScript library You can use the library to manipulate HTML documents, add animations, perform event handling, and do a lot more things. JQuery is compatible with many browsers so pages made in one of them will run successfully on other browsers. The aim of designing this library is to make client-side scripting easy. Why JQuery Alternatives? JavaScript commands needed to run JQuery CSS and JavaScript knowledge is required to work on JQuery Debugging a JQuery code is difficult Each update of JQuery has to be downloaded from Google How to ... Read More

130 Views
Overview A class in any element defines the type of the data contained in an element. A same class name can be taken by another tag or element also. There is no such property for the class attribute that the class name should be unique. To find whether all the elements contain the same classes or not, can be achieved with the help of HTML, CSS and JavaScript. The HTML provides the layout of the page and the layout for the elements for the same classes and the JavaScript will provide the functionality to check whether all the elements contain ... Read More

111 Views
Overview A vanilla JavaScript is a framework of JavaScript, it provides mainly two different methods to find the width of a div using the "offsetWidth" and "clientWidth". Both methods have the ability to find the width of any element on a web page. In this vanilla JavaScript refers to the methods of the JavaScript that are predefined for the developers. It provides cross-platform compatibility. Syntax The Syntax to find the width of the div is given below. These two methods are used to calculate the width of the div. elementHTML.offsetWidth elementHTML.clientWidth elementHTML − It is the div ... Read More