
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 2202 Articles for HTML

107 Views
To match any string containing a sequence of two to three p’s with JavaScript RegExp, use the p{2,3} Quantifier.Example JavaScript Regular Expression var myStr = "Welcome 1, 10, 100, 1000, 1000"; var reg = /\d{2,3}/g; var match = myStr.match(reg); document.write(match);

257 Views
To add properties and methods to an object in JavaScript, use the prototype property.ExampleYou can try to run the following code to learn how to work with prototype − JavaScript prototype property function book(title, author) { this.title = title; this.author = author; } var myBook = new book("Amit", "Java"); book.prototype.price = null; myBook.price = 500; document.write("Book title is : " + myBook.title + ""); document.write("Book author is : " + myBook.author + ""); document.write("Book price is : " + myBook.price + "");

164 Views
To match any string containing a sequence of N p’s with JavaScript RegExp, use the p{N} Quantifier.ExampleYou can try to run the following code to match any string containing a sequence of N p’s − JavaScript Regular Expression var myStr = "Welcome 1, 100, 10000, 1000"; var reg = /\d{3}/g; var match = myStr.match(reg); document.write(match);

186 Views
To match any string containing zero or more p’s with JavaScript RegExp, use the p* Quantifier.ExampleYou can try to run the following code to match any string containing zero or more p’s. Here, p is considered as a number of occurrences − JavaScript Regular Expression var myStr = "Welcome! Wweeeelcome to our website!"; var reg = /el*/g; var match = myStr.match(reg); document.write(match);

173 Views
To match any string containing zero or one p’s with JavaScript RegExp, use the p? Quantifier.ExampleYou can try to run the following code to match any string containing zero or one p. Here p is considered a number of occurrences − JavaScript Regular Expression var myStr = "Welcome 1, 100, 10000, 10000"; var reg = /10?/g; var match = myStr.match(reg); document.write(match);

91 Views
Use the reduceRight() method in JavaScript to apply a function simultaneously against two values of the array from right-to-left 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 callbackExampleYou can try to run the following code to learn how to work with reduceRight() method in JavaScript − JavaScript Array reduceRight Method if (!Array.prototype.reduceRight) ... Read More

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

269 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

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

187 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