InterviewSolution
Saved Bookmarks
| 1. |
What is onclick event in JavaScript? |
|
Answer» Let’s say the following is our string with numbers and special characters: var strNum = "DEMO989#@#@"; The following RegExp is used to get a non-digits: \D/gAbove we have set the g flag to PERFORM global match. The following is the code: <HTML> <head> <title>Regular Expression in JAVASCRIPT</title> </head> <body> <SCRIPT> var strNum = "DEMO989#@#@"; var regExp = /\D/g; document.write("String with numbers and characters = "+strNum) var res = strNum.match(regExp); document.write("<br>GETTING Non-Digits = "+res); </script> </body> </html>The output displays non-digits: String with numbers and characters = DEMO989#@#@ Getting Non-Digits = D,E,M,O,#,@,#,@ |
|