JSFiddle - React, Tailwind, and code Playground

by cmruser

JavaScript

var arr = [{
label: "Zyxel Tech Support",
value: "Zyxel Tech Support|#|1130 N.Miller St|#|Anaheim|#|California|#|United States|#|92806|#|1937695|#|"
}]

var a = arr.reduce((array, i) => {
	const {label, value} = i;
  
	return array = [...array, {select: false, label, value: value.split('|#|').slice(-2)[0]}]
}, []);



console.log(a);