-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.html
35 lines (33 loc) · 980 Bytes
/
test.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
31
32
33
34
35
<!DOCTYPE html>
<html lang="en">
<head>
<title>String Operation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script>
$(function(){
var userInput = prompt("Enter any number: ");
var print = 1;
for(var i=1; i<=userInput; i++){
var str = [];
for(var j=0; j<i; j++){
str.push(print);
print++;
}
if((i%2) == 0){
str = str.reverse();
}
str = str.join("*");
document.write(str);
document.write("*<br />");
}
});
</script>
</head>
<body>
</body>
</html>