Previous | Home | Next |
How to use sup() Method in JavaScript
The sup() method is used to display a string as superscript text.
Syntax:
string.sup()
Example:
<html> <body> <script language="javascript"> function sup_win() { var myString = new String('Two'); document.write('Square'+myString.sup()); } </script> <button onclick="sup_win()"> sup me</button> </body> </html>
Out Put:
How to use sort() Method in JavaScript
The sort() method sorts the elements of an array.
Syntax:
array.sort(sortfunc)
Example:
<html> <body> <script language="javascript"> function sort_array() { var myString = new Array('Anil','Aditya','Ashish'); myString.sort(); alert(myString); } </script> <button onclick="sort_array()">Sort Array</button> </body> </html>
Out Put:
Previous | Home | Next |