Sort nested list by list

How can I efficiently sort nested lists by the first element of each nested list matching the order given in order list? Nested list: [[97, 2, 0, 2], [97, 2, 0, 2], [98, 1, 2, 3], [99, 3, 3, 6], [99, …

javascript joining similar array

const word = [“house”, “mango”, “window”, “watermelon”] const component = [“us”, “man”, “ous”, “go”, “water”, “melon”, “win”, “dow”] const output = [{ “word”: “house”, “component”: [“us”, “ous”] }…