JSFiddle - React, Tailwind, and code Playground

JavaScript

module.exports = function (inputData, inputDictionary) {
	inputData.sort((item1, item2) => item1.geometry[0] - item2.geometry[0]);

    const textMessages = inputData.map(item => item.text);

	for(let i = 0; i < textMessages.length; i++){
    	if(!inputDictionary.includes(textMessages[i])){
        	return "Unreadable message";
        }
    }

    return textMessages.join(" ");
}