Saturday, July 23, 2011

JavaScript Exercises - reverse() of Array

example:
JavaScript Exercises - reverse() of Array

<!DOCTYPE html>
<html>
<head>
<title>JavaScript Exercise</title>
<script type="text/javascript">

function exercise(){
var stringsource = "A man and a pen";
var result = "reverse() of Array= " + stringsource.split(" ").reverse() + "\n";

alert(result);
}


function htmlonload(){
exercise();
}
</script>
</head>
<body onload="htmlonload();">
JavaScript Exercise
</body>
</html>

No comments:

Post a Comment