JSFiddle - React, Tailwind, and code Playground

by luka kupunia

HTML

<div class="box1">
  <div class="box2">
    <div class="box3"></div>
  </div>
</div>
<button>remove</button>

CSS

body {
  margin: 0;
}
* {
  box-sizing: border-box;
}
div.box1 {
  width: 400px;
  height: 300px;
  background: red;
  position: relative;
}
div.box2 {
  width: 200px;
  height: 150px;
  background: black;
  position: unset;
}
div.box3 {
  width: 100px;
  height: 100px;
  background: yellow;
  position: absolute;
  left: 50%;
  transition: 1s;
}

JavaScript

function almostIncreasingSequence(sequence) {
    var a = sequence.length;

		function sortSeq(a,b){
    	return a - b;
    }
   /*  var c = sequence.sort(sortSeq); */
    
    var d = [];
    
    
    for ( var i = 0; i < a; i++ ){
      d.push(sequence[i]);
      
      if(i === a - 1) {
      	var e = d.sort(sortSeq);
    
    		console.log( sequence == e );
    
        console.log('a' , sequence ,'b',  e );
      }

    }
    
}
almostIncreasingSequence([ 1, 2, 2 , 2 ])