How to check for @ in mail?

  • 0
    How do I check for @ in my mail?
    JavaScript Anonymous, Dec 7, 2019

  • 4 Answers
  • 0
    const email = "[email protected]";
    email.includes("@"); // true
    Milo Mora

  • 0
    let str = '[email protected]';

    //вот такая вот функция
    const check = str => /@/g.test(str);

    console.log(check(str));
    Nathaniel Bishop

  • 0
    More options

    var a = '[email protected]';

    if(a === a.replace('@','')){
    console.log('здесь собаки нет');
    }
    if(a.split('@').length === 1){
    console.log('здесь собаки нет');
    }
    Sebastien Holder

  • 0
    let mail = '[email protected]'
    if(mail.includes('@')) alert('Собачка имеется')
    else alert('Собачка отсутствует')
    Anonymous

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!