JSFiddle - React, Tailwind, and code Playground

by Diana Lemen

JavaScript

let a = [1,2,3,4,5,6,7,8,9]
let b = [];
for(let i=0; i<=a.length; i++){
b[i] = a[i]
if(i>=4){
if(i==4){
b[i]=10;
} else {
b[i]=a[i-1]
}
}
}
console.log(b);