1const string = "javascript";
2const substring = "script";
3
4console.log(string.includes(substring)); //true
1<!DOCTYPE html>
2<html lang="en">
3<head>
4 <meta charset="UTF-8">
5 <meta http-equiv="X-UA-Compatible" content="IE=edge">
6 <meta name="viewport" content="width=device-width, initial-scale=1.0">
7 <title>Document</title>
8</head>
9<body>
10 <input type="text" id='input'>
11<button type="button" onclick='btn()'>Alert</button>
12
13
14<script>
15function btn(){
16var input=document.getElementById('input').value;
17
18 var subs=[
19'name','what','child','all','candy'
20 ];
21 for (let i = 0; i <subs.length; i++) {
22
23
24
25 if(input.includes(subs[i])){
26 alert("includes " + subs[i]);
27 }
28 else{
29 console.log('dosnt include '+ subs[i]);
30 }
31}
32}
33
34</script>
35</body>
36</html>