Write function to return true if passed array is sorted, or return false

Write function to return true if passed array is sorted, or return false

by soumya gangamwar

HTML

<div id="inputarra">
https://jsfiddle.net/soumyagangamwar/208mzft3/28/#save  
</div>

<div id="outputarr">

</div>

JavaScript

console.log('tttt')

//(function () {
function testSorting(arr) {
   var obj = arr[0];
   var temp = false;
   
   for(var i = 0; i < arr.length-1; i++) {
  
   		if (arr[i] < arr[i+1]) {
      temp = true;

			}  else {
  		 temp = false;
			}
 }
 
 var h = document.createElement("H1")
 var o = document.createElement("H1")   // Create a <h1> element
var t = document.createTextNode("Input:" + arr);  
var op =  document.createTextNode("ouput:" + temp);

//Create a text node
h.appendChild(t); 
o.appendChild(op)
 document.body.appendChild(h);
 document.body.appendChild(o);
 return temp;
}

console.log(testSorting([2, 6, 8]));
console.log(testSorting([2, 8, 6]));
console.log(testSorting([2, 3, 8, 6]));
console.log(testSorting([2, 6, 7]));
//}());