
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 445 Articles for Programming Scripts

222 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 );

165 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

457 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

244 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 );

108 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() );

79 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 );

110 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

104 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

767 Views
To find a tab character with JavaScript Regular Expression, use the following −\tExampleYou can try to run the following code to find a tab character. It returns the position where the tab (\t) character is found − JavaScript Regular Expression var myStr = "Simple \t Responsive!"; var reg = /\t/; var match = myStr.search(reg); document.write(match);

79 Views
JavaScript date setUTCMonth ( ) method sets the month for a specified date according to universal time.The following is the parameter of setUTCMonth ( monthvalue ) method in JavaScript −monthValue − An integer between 0 and 11, representing the month.ExampleYou can try to run the following code to set the month for a specified date according to universal time − JavaScript getUTCSeconds Method var dt = new Date( "Aug 28, 2008 13:30:00" ); dt.setUTCMonth( 2 ); document.write( dt );