JavaScript code snipped to validate an email addres

Front end validations are requird for web applications while the backend validations protects us on the server side. So basically this code is a regulation expression that does simple raw Js to validate an email address.

    function checkEmail() {
        var email = document.getElementById(’emailaddress’);
        var filter = '/^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/';
        if (!filter.test(email.value)) {
            alert('Please provide a valid email address');
            return false;