- 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 2416 Articles for HTML
146 Views
To match any string containing one or more p’s with JavaScript RegExp, use the p+ Quantifier.ExampleYou can try to run the following code to match any string containing one or more p’s. Here p is considered as a number of occurrences − JavaScript Regular Expression var myStr = "Secure and Responsive!"; var reg = /s+/g; var match = myStr.match(reg); document.write(match);
200 Views
JavaScript array filter() method creates a new array with all elements that pass the test implemented by the provided function. The following are the parameters − callback − Function to test each element of the array. thisObject − Object to use as this when executing callback. You can try to run the following code to learn how to work with filter() method in JavaScript − Example Live Demo JavaScript Array filter Method ... Read More
161 Views
JavaScript array toSource() method returns a string representing the source code of the array. This method is supported by Mozilla.ExampleYou can try to run the following code to learn how to represent the source code of an object with JavaScript Arrays − JavaScript Array toSource Method var arr = new Array("football", "baseball", "volleyball", "cricket"); var str = arr.toSource(); document.write("Returned string is : " + str );
127 Views
Use the reduce() method in JavaScript to apply a function simultaneously against two values of the array from left-to-right as to reduce it to a single value.The following are the parameters −callback − Function to execute on each value in the array.initialValue − Object to use as the first argument to the first call of the callback.ExampleYou can try to run the following code to learn how to work with reduce() method in JavaScript − JavaScript Array reduce Method if (!Array.prototype.reduce) { ... Read More
414 Views
The Date object is a datatype built into the JavaScript language. Date objects are created with the new Date( ) as shown below.Once a Date object is created, a number of methods allow you to operate on it. Most methods simply allow you to get and set the year, month, day, hour, minute, second, and millisecond fields of the object, using either local time or UTC (universal, or GMT) time.You can use any of the following syntaxes to create a Date object using Date() constructor −new Date( ) new Date(milliseconds) new Date(datestring) new Date(year, month, date[, hour, minute, second, millisecond ])The ... Read More
214 Views
JavaScript date getTimezoneOffset() method returns the time-zone offset in minutes for the current locale. The time-zone offset is the minutes in difference; the Greenwich Mean Time (GMT) is relative to your local time.ExampleYou can try to run the following code to return the time-one offset in minutes − JavaScript getTimezoneOffset Method var dt = new Date(); var tz = dt.getTimezoneOffset(); document.write("getTimezoneOffset() : " + tz );
72 Views
JavaScript date getUTCDay() method returns the day of the week in the specified date according to universal time. The value returned by getUTCDay() is an integer corresponding to the day of the week: 0 for Sunday, 1 for Monday, 2 for Tuesday, and so on.ExampleYou can try to run the following code to return the day of the week in the specified date − JavaScript getUTCDay Method var dt = new Date( "January 15, 2018 20:15:20" ); document.write("getUTCDay() : " + dt.getUTCDay() );
51 Views
JavaScript date setUTCDate() method sets the day of the month for a specified date according to universal time.The following is the parameter for setUTCDate(dayValue) −dayValue − An integer from 1 to 31, representing the day of the month.ExampleYou can try to run the following code to set the day of the month for a specified date − JavaScript setUTCDate Method var dt = new Date( "Oct 15, 2017 23:30:00" ); dt.setUTCDate( 20 ); document.write( dt );
66 Views
JavaScript date setUTCFullYear() method sets the full year for a specified date according to universal time.The following are the parameters for setUTCFullYear(yearValue[, monthValue[, dayValue]]) −yearValue − An integer specifying the numeric value of the year, for example, 2008.monthValue − An integer between 0 and 11 representing the months January through December.dayValue − An integer between 1 and 31 representing the day of the month. If you specify the dayValue parameter, you must also specify the monthValue.ExampleYou can try to run the following code to set the full year for a specified date according to universal time − ... Read More
57 Views
JavaScript date setUTCHours() method sets the hour for a specified date according to local time. The following is the parameter for setUTCHours(hoursValue[, minutesValue[, secondsValue[, msValue]]]) −hoursValue − An integer between 0 and 23, representing the hour.minutesValue − An integer between 0 and 59, representing the minutes.secondsValue − An integer between 0 and 59, representing the seconds. If you specify the secondsValue parameter, you must also specify the minutesValue.msValue − A number between 0 and 999, representing the milliseconds. If you specify the msValue parameter, you must also specify the minutesValue and secondsValue.ExampleYou can try to run the following code to ... Read More