Read an element within an iframe

I’m building an Edge extension. I’m trying to get the exact same element as this question asks, but I want to use JS, not Selenium.
Element

I’m running the JS through my extension’s background script. In the future, I would like the popup to have a button and that button to read the syllable on screen.

The provided solution is in Selenium and I’d like to transpile it into JS.
driver.switch_to_frame(driver.find_element_by_xpath("//div[@class='game']/iframe[contains(@src,'jklm.fun')]"))

If none of this works, I guess I’ll have to use optical text recognition.

Here’s manifest.json

{
    "name": "myName",
    "description": "myDescription",
    "version": "1.0.0",
    "manifest_version": 3,
    "icons": {
        "128": "myIcon.png"
    },
    "content_scripts": [
        {
            "matches": [
                "https://jklm.fun/*"
            ],
            "js": [
                "js/myScript.js"
            ]
        }
    ]
}

Inside js folder, here’s myScript.js

console.log('myscript is running')

const syllableHandler = () => { 
    const iframe = document.getElementsByTagName("iframe")
    console.log(iframe?.[0]?.contentWindow)
}

document.addEventListener('keydown', syllableHandler)