JSFiddle - React, Tailwind, and code Playground

by thelifeisyours

CSS

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: #272727;
  color: #e2e2e2;
  font-family: Arial, sans-serif;
}

.printValue {
  margin: 0.5em;
  padding: 0.25em;
  
}

JavaScript

const rndRangeInt = (_min, _max) => {return Math.floor(Math.random() * ((_max + 1) - _min) + _min)}

const sortArr = (_arr) => {
  let temp = _arr;
	let res = [];
	
  let min = Infinity;
  
  for(let i = 0; i < _arr.length; i++){
  	
    let n1 = _arr[i];

    for(let j = 0; j <= temp.length; j++){
    	
      let n2 = temp[j];

      if(n1 < min){
					min = n1;
      }
      
    }

    console.log(min);
  }
  
  return res;
}

const printValue = (_val) => {
	let body = document.querySelector('body');
  let newVal = document.createElement('div');
  newVal.classList.add('printValue');
  
  newVal.innerHTML = _val;	
	
  console.log(_val);
  console.log(newVal);
  
  body.append(newVal);
  
  return newVal;
}




let arr = Array.from(Array(5), () => rndRangeInt(0, 10));

printValue(arr);
printValue(sortArr(arr));