- 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 8895 Articles for Front End Technology
![Shubham Vora](https://www.tutorialspoint.com/assets/profiles/485898/profile/60_1456867-1657516792.jpeg)
7K+ Views
This tutorial teaches us to find the number of days between the two dates in JavaScript. If you are a developer, sometimes you face the scenario where you need to find the number of days between 2 dates.For example, if you are building a software application to keep track of employees' attendance and salary. If an employee leaves without completing the month, you need to count the number of days the employee attended in the current month to give the salary. Furthermore, there can be many scenarios like the above example.In this tutorial, we will see the different methods to ... Read More
![Jennifer Nicholas](https://www.tutorialspoint.com/assets/profiles/13569/profile/60_88876-1512715262.jpg)
1K+ Views
To get dates in JavaScript, use the getTime() method. Forgetting the difference between two dates, calculate the difference between date and time.ExampleYou can try to run the following code to learn how to calculate a difference between two dates −Live Demo var dateFirst = new Date("11/25/2017"); var dateSecond = new Date("11/28/2017"); // time difference var timeDiff = Math.abs(dateSecond.getTime() - dateFirst.getTime()); // days difference var diffDays = Math.ceil(timeDiff / (1000 * 3600 * 24)); // difference alert(diffDays);
![Rishi Rathor](https://www.tutorialspoint.com/assets/profiles/13563/profile/60_89283-1512714754.jpg)
92 Views
Here’s the best way to read cookies by name in JavaScript. The following is the function −function ReadCookie() { var allcookies = document.cookie; document.write ("All Cookies : " + allcookies ); // Get all the cookies pairs in an array cookiearray = allcookies.split(';'); // Now take key value pair out of this array for(var i = 0; i < cookiearray.length; i++) { name = cookiearray[i].split('=')[0]; value = cookiearray[i].split('=')[1]; document.write ("Key is : " + name + " and Value is : " + value); } }
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
2K+ Views
Tables in HTML can have horizontal header and vertical header. For the horizontal header, we need to set all inside a single tag. Syntax Following is the syntax to set horizontal header for a table − horizontal header1… horizontal header2… Example 1 Now let us see an example program to set horizontal header for a table. DOCTYPE html> table, tr, th, ... Read More
![Kumar Ishan](https://www.tutorialspoint.com/assets/profiles/512548/profile/60_2150077-1662350620.jpeg)
10K+ Views
To generate a random number, we use the Math.random() function. This method returns a floating-point number in the range 0 (inclusive) to 1 (exclusive). To generate random numbers in different range, we should define the minimum and maximum limits of the range. Please follow the second syntax below for this. To generate random integers, you can follow the third and fourth syntax discussed below. As the Math.random() method gives us a random floating point number so to convert the result into an integer, we need to apply some basic math. Please follow the below syntaxes. Syntax Following is the syntax ... Read More
![Krantik Chavan](https://www.tutorialspoint.com/assets/profiles/13545/profile/60_126883-1512724834.jpg)
933 Views
The standard Unix epoch is an expression in seconds. The Unix epoch or Unix time is the number of seconds elapsed since January 1, 1970.The getTime() method is used to return the millisecond representation of the Date object.To get time in milliseconds, use the following:var milliseconds = (new Date).getTime();
![Lokesh Badavath](https://www.tutorialspoint.com/assets/profiles/538106/profile/60_1039031-1666073315.jpg)
41K+ Views
The rowspan and colspan are the attributes of tag. These are used to specify the number of rows or columns a cell should merge. The rowspan attribute is for merging rows and the colspan attribute is for merging columns of the table in HTML. These attributes should be placed inside the tag as shown in the image given below − Syntax Following is the syntax to merge table cells in HTML − cell data cell data Example 1 − Setting the rowspan Now let us look at an example where we set the rowspan of the ... Read More
![Nancy Den](https://www.tutorialspoint.com/assets/profiles/13557/profile/60_88439-1512714529.jpg)
385 Views
To get an integer in the string “abcde 30”, use the following regex in JavaScript, else it will return NaN. With that, use parseInt() to get the numbers with regex under String match() method −ExampleLive Demo var myStr = "abcdef 30"; var num = parseInt(myStr.match(/\d+/)) alert(num);
![Daniol Thomas](https://www.tutorialspoint.com/assets/profiles/13551/profile/60_130035-1512726078.jpg)
351 Views
Use the toString() method to get the string representation of a number. You can try to run the following code to print a string representation of numbers like 20, -40, 15.5 −ExampleLive Demo var num1 = 25; document.write(num1.toString()+""); document.write((30.2).toString()+""); var num2 = 3; document.write(num2.toString(2)+""); document.write((-0xff).toString(2)); Output25 30.2 11 -11111111Above, you can see we added a parameter to the toString() method. This is an optional parameter, which allows you to add an integer between 2 and 36, which is the base for representing numeric values.