-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoption.html
More file actions
35 lines (33 loc) · 1.03 KB
/
option.html
File metadata and controls
35 lines (33 loc) · 1.03 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<label for="iarr1">enter the elements of the array seprateed by cooma</label>
<input type="text" maxlength="12" id="a1">
<br>
<label for="iarr2">enter the elements of the array seprateed by cooma</label>
<input type="text" maxlength="12" id="a2">
<br>
<button onclick="fun()" style="width: fit-content;">enter for merge and remove duplicate</button>
<script>
var iarr1=document.getElementById("a1").value
var iarr2=document.getElementById("a2").value
var arr1 = iarr1.split(",")
var arr1 = iarr1.split(",")
var arr= arr1.concat(arr2)
var newarr=[]
function fun(){
for(i=0;i<arr.length;i++){
if(!newarr.includes(arr)){
newarr.push(arr)
}
}
}
document.write(newarr)
</script>
</body>
</html>