<script type="text/javascript">
function f1() {
var Products = ['A','C','D','B'];
Products.sort();
Products.reverse();
document.write(`${Products.toString()}`);
}
f1();
</script>
Using 'sort()' output:- A B C D
Using both 'sort()' & 'reverse()' output:- D C B A
Posted By: pankaj_bhakre
function f1() {
var Products = ['A','C','D','B'];
Products.sort();
Products.reverse();
document.write(`${Products.toString()}`);
}
f1();
</script>
Using 'sort()' output:- A B C D
Using both 'sort()' & 'reverse()' output:- D C B A
Posted By: pankaj_bhakre
No comments:
Post a Comment