Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Programming Scripts Articles
Page 19 of 33
With JavaScript Regular Expression find a non-whitespace character.\\n\\n
To find a non-whitespace character, use the following −\SExampleYou can try to run the following code to find non-whitespace character − JavaScript Regular Expression var myStr = "100% Responsive!"; var reg = /\S/g; var match = myStr.match(reg); document.write(match);
Read MoreFor Hosts Locale how to convert a string to lowercase letters in JavaScript?
To convert a string to lowercase letters in JavaScript, use the toLocaleLowerCase() method. Example You can try to run the following code to learn how to work with toLocaleLowerCase() method in JavaScript − var a = "WELCOME!"; document.write(a.toLocaleLowerCase());
Read MoreWith JavaScript RegExp search a carriage return character.
To find carriage return character with JavaScript Regular Expression, use the following −\rExampleYou can try to run the following code to find a carriage return character. It returns the position where the carriage return (\r) character is found − JavaScript Regular Expression var myStr = "100% \r Responsive!"; var reg = /\r/; var match = myStr.search(reg); document.write(match);
Read MoreWhat is the usage of in operator in JavaScript?
The operator is used in JavaScript to check whether a property is in an object or not. Example You can try to run the following code to learn how to use in operator in JavaScript – var emp = {name:"Amit", subject:"Java"}; document.write("name" in emp); document.write(""); document.write("subject" in emp); document.write(""); document.write("MAX_VALUE" in Number); document.write(""); document.write("MIN" in Number);
Read MoreWith JavaScript RegExp find a character except newline?
To find a character except for a newline, use the Metacharacter. (period). You can try to run the following code to find a character −Example JavaScript Regular Expression var myStr = "We provide websites! We provide content!"; var reg = /p.o/g; var match = myStr.match(reg); document.write(match);
Read MoreWith JavaScript DOM delete rows in a table?
To delete rows in a table in JavaScript, use the DOM deleteRow() method. Example You can try to run the following code to learn how to delete rows in a table. The code deletes rows one at a time − function captionFunc(x) { document.getElementById(x).createCaption().innerHTML = "Demo Caption"; } One Two Three Four Five Six
Read MoreHow to create a table caption with JavaScript DOM?
To create a table caption, use the DOM createCaption() method. Example You can try to run the following code to learn how to create table caption − function captionFunc(x) { document.getElementById(x).createCaption().innerHTML = "Demo Caption"; } One Two Three Four Five Six
Read MoreHow to perform Multiline matching with JavaScript RegExp?
To perform multiline matching, use the M modifier available in JavaScript Regular Expression.ExampleYou can try to run the following code to perform multiline matching − JavaScript Regular Expression var myStr = "Welcoming!"; var reg = /^ing/m; var match = myStr.match(reg); document.write(match);
Read MoreWhich is the JavaScript RegExp to find any alternative text?
To match any of the specified alternatives, follow the below-given pattern −(foo|bar|baz)ExampleYou can try to run the following code to find any alternative text − JavaScript Regular Expression var myStr = "one,one,one, two, three, four, four"; var reg = /(one|two|three)/g; var match = myStr.match(reg); document.write(match);
Read MoreHow can I write a script to use either W3C DOM or IE 4 DOM depending on their availability?
If you want to write a script with the flexibility to use either W3C DOM or IE 4 DOM depending on their availability, then you can use a capability-testing approach that first checks for the existence of a method or property to determine whether the browser has the capability you desire.The following is the code snippet showing the same −if (document.getElementById) { // If the W3C method exists, use it } else if (document.all) { // If the all[] array exists, use it } else { // Otherwise use the legacy DOM }
Read More