- 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
83 Views
To match any string containing a sequence of at least two p’s with JavaScript RegExp, use the p{2,} Quantifier.Example JavaScript Regular Expression var myStr = "Welcome 1, 10, 100, 1000"; var reg = /\d{2,}/g; var match = myStr.match(reg); document.write(match);
3K+ Views
In this tutorial, we will convert Boolean to Number in JavaScript. The Boolean is the variable's data type, which is supported by JavaScript like the other programming languages. The Boolean data type contains only two values, true and false. In some cases, programmers must convert the true or false value to the number. For example, using the strict equality operator to compare the Boolean value with the number variable. Here, using different operators, we have three methods to convert the Boolean to a number. Using the Number() Function In JavaScript, the Number() function is useful to convert any variable to ... Read More
63 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);
190 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 + "");
105 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);
130 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);
122 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);
49 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