Strip Numbers from a String using JavaScript

A code snippet to take all number off a string using JavaScript <script> var MyString = "Tutorials1P2anel3"; stringOnly = MyString.replace(/[0-9]/g, ''); alert(stringOnly); </script> You can replace the alert with anything else that would fit your coding needs. Related Snippets

Email validation function using JavaScript

A Javascript function to check email validation. Returns boolean. function ValidateEmail(email) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/; if (!reg.test(email)) return false; return true; } Happy Coding! Related Snippets

Select a Random Item from an Array using JavaScript

The snippet below selects a random item from an array and show it in an alert box using Javascript. <script> var arr = [ "ASP.NET", "C", "C++", "C#", "Java", "JavaScript", "MVC CORE", "VB.NET" ]; var random = arr[Math.floor(Math.random()*arr.length)]; alert(random) </script> Happy Coding! Related Snippets