-
Notifications
You must be signed in to change notification settings - Fork 0
/
arraytranspose.html
58 lines (44 loc) · 1.25 KB
/
arraytranspose.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<html>
<body>
<script src="arraytranspose.js">
//map func -roundoff
var arr=[2.1,3.5,4.7];
var result=arr.map(Math.round);
document.write(result);
</script>
<br>
<script>
//sort -arrange the data in ascending order
var arr=["Angularjs","Nodejs","JQuery"];
document.write(arr);
var result=arr.sort();
document.write("<br>");
document.write(result);
</script>
<br>
<script>
//sort -
var arr=[2,4,1,8,5];
var result=arr.sort(function compare(a,b)
{
return a-b;
});
document.write(result);
</script>
<br>
<script>
//reverse-opposite
var arr=["Sam","Mus","Eli","OK"];
var rev=arr.reverse();
document.write(rev);
</script>
<br>
<script>
var text="my name is jeeban ";
var result2=text.split('-');
var arr=["Angularjs","Nodejs","Jquery"];
var reuslt=arr.join('-');
document.write(result);
</script>
</body>
</html>