Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

How to sort array value using sort() method in JavaScript

<!DOCTYPE html>
<html>
<body>
<p>sort array value in alphabatical order</p>
<p>Click on button click we can see our short array value</p>
<button onclick="banksNameInAlphabaticalOrder()" id="btnClick">Click</button>
<p id="pId"></p>
<script>
var banksOfIndis = ["CentralBankOfIndia","AndhraBank","BankOfBaroda","CanaraBank","AllhabadBank"];
function banksNameInAlphabaticalOrder() {
banksOfIndis.sort();
document.getElementById("pId").innerHTML = banksOfIndis;
}
</script>
</body>
</html>
Source by www.enjoysharepoint.com #
 
PREVIOUS NEXT
Tagged: #How #sort #array #method #JavaScript
ADD COMMENT
Topic
Name
3+2 =