Ad
Code
Diff
  • const parse = (value) => {
        // if valid email, return true, else return false
        const validCharacters = /[\w+]/ig
        const result = validCharacters.exec(value).input;
        if(result.includes('@') && result.includes('.') && !result.includes(' ') ){
            return true;
        }
        else
        {
            return false;
        }
    }
    • const parse = (value = '') => {
    • // if valid email, return true, else return false
    • let validEmail;
    • const validCharacters = ["a","A", "b","B","c","C","d","D","e","E","f","F",
    • "g","G","h","H","i","I","j","J","k","K","l","L",
    • "m","M","n","N","o","O","p","P","q","Q","r","R",
    • "s","S","t","T","u","U","v","V","w","W","x","X",
    • "y","Y","z","Z","0","1","2","3","4","5","6","7",
    • "8","9","@","."]
    • const emailArray = value.split("");
    • for (let i = 0; i < emailArray.length; i++) {
    • if (validCharacters.includes(value[i]) == true) {
    • validEmail = true;
    • const parse = (value) => {
    • // if valid email, return true, else return false
    • const validCharacters = /[\w+]/ig
    • const result = validCharacters.exec(value).input;
    • if(result.includes('@') && result.includes('.') && !result.includes(' ') ){
    • return true;
    • }
    • else {
    • validEmail = false;
    • break;
    • else
    • {
    • return false;
    • }
    • }
    • return validEmail;
    • }