This is very basic tutorial of javascript where you will learn how to check if string contains array of substrings.

Subscribe: https://www.youtube.com/c/FWAIT/featured

Source Code


const validDomains = ['gmail.com', 'hotmail.com', 'yahoo.com'];
 
const email = 'I have accounts at gmail.com and yahoo.com';
 
const result = validDomains.every(domain => email.includes(domain));
 
console.log(result);


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
    <script src="script.js"></script>
</body>
</html>

#javascript

How to Check If String Contains Array of Substrings in Javascript
27 Likes18.30 GEEK