You should only need a single array with all the messages . You know that first 4 items in the array are messages you want to display . This can be easily done with var display messages . slice 0 , 4 . If there are less than 4 items , there are also less than 4 items in the slice . Note that you shouldn ' t modify the slice , only the original with all items , because they aren ' t synced automatically . You can always call slice again . In React this is easy if you simply pass the slice as a prop to some component . <| sep |> Remarkably bad judgement for a CEO , given the unintended consequences <| sep |> You heard the marketing professional guys , delete those nasty commemts ! Wouldn ' t it be better to graciously accept your fuckup than telling your potential customers to silence themselves ?