Answer:
<html>
<body>
<button onclick="sort1()">sort me</button>
<script>
var a=45;
var b=-1;
var c= 44;
function sort1() // function sort1
{
if (a>b && a>c)
{
if (b>c)
{
console.log(a + ", " + b + ", " +c);
}
else
{
console.log(a + ", " + c + ", " +b);
}
}
else if (b>a && b >c)
{
if (a>c)
{
console.log(b + ", " + a + ", " +c);
}
else
{
console.log(b + ", " + c + ", " +a);
}
}
else if (c>a && c>b)
{
if (a>b)
{
console.log(c + ", " + a + ", " +b);
}
else
{
console.log(c + ", " + b + ", " +a);
}
}
}
}
Output:
45 44 -1
</script>
</body>
</html>
Step-by-step explanation:
In this we create a program in javascript so we create a three variable in the function sort1() the variable i.e a,b,c after that check the condition if (a>b && a>c) In this it check if variable "a>b "and it is also greater then c then it check check for "b>c" if "b>c" then it print the value of "a,b,c" otherwise print" a,c,b" similarly other conditional statement will check display the required output in webpage .