-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlab2.html
30 lines (30 loc) · 914 Bytes
/
lab2.html
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
<!DOCTYPE html>
<html>
<head>
<title>lab2</title>
</head>
<body>
<script>
var rev=0;
var n=prompt("Give input:"," ");
if(!isNaN(parseInt(n))){
var num=parseInt(n);
while(num!=0){
rem=num%10
num=parseInt(num/10)
rev=rem+rev*10
}
alert("The reversed number is "+parseInt(rev));
}
else{
str=n.toUpperCase();
for(i=0;i<str.length;i++){
if(str.charAt(i)=='A'||str.charAt(i)=='E'||str.charAt(i)=='I'||str.charAt(i)=='O'||str.charAt(i)=='U'){
alert("Position of alphabet "+str.charAt(i)+" is "+(i+1));
break;
}
}
}
</script>
</body>
</html>