-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathscratch.html
More file actions
48 lines (36 loc) · 804 Bytes
/
Copy pathscratch.html
File metadata and controls
48 lines (36 loc) · 804 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<!DOCTYPE html>
<html>
<body>
<p id="demo">Test</p>
<button onclick="myFunction()">Try it</button>
<script>
function randomPick(array) {
var randomNumber = Math.floor(Math.random() * (array.length));
return array[randomNumber];
}
function print(str) {
document.getElementById("demo").innerHTML = str;
}
function aan(string) {
var firstLetter = string[0]
if (firstLetter == 'a' || firstLetter == 'e' || firstLetter == 'i' || firstLetter == 'o' || firstLetter == 'u'){
string = 'an ' + string
} else {
string = 'a ' + string
}
return string
}
function inside(needle, haystack) {
var count = haystack.length;
for(var i = 0; i < count; i++)
{
if(haystack[i] === needle){
return true;
}
}
return false;
}
//Code starts here
</script>
</body>
</html>