JSFiddle - React, Tailwind, and code Playground

by Diana Lemen

JavaScript

const A = [5,2,4,6,1,3];
const B = [];
B.push(A[0]);
for(let j = 2; j < A.length; j++) {
  let i = j - 1;
	let key = A[i];
  for(let y = B[i - 1]; y >= key; i--) {
  	const a = y;
    B[i - 1] = key;
    B[i] = a;
  }
}
console.log(B);
console.log('bla');