I have two arrays. They look like this but are longer in my code.
let arrayA = [{heading: "heading2", body: "text body2"}, {heading: "heading", body: "text body"}, {heading: "heading4", body: "text body4"}, {heading: "heading3", body: "text body3"}]
let arrayB = ["heading", "heading2", "heading 3", "heading 4"]
My html page needs to loop over arrayA and for each item return
<h1>item.heading</h1>
<p>item.body</p>
How would i go about sorting arrayA to get the same order as arrayB ?