VELO Typewriter Effect

Hello everyone,

i struggle to implement the code, why is it not running?

$w.onReady(() => {
    typeAndErase($w("#typerwriterText")) //Just the function call
})

function typeAndErase(#text36) {
    let interval
    let backspaceInterval
    let timeInterval = 300
    let typeStrings = ["Weiterbildung", "Unterstützung", "Diversität"]
    let stringStart = "" //<-- if you don't want a starting string just set this to ""
    let wordIdx = 0
    let typeIdx = 0
    let displayStr = stringStart
    let endingString = "|"
    let direction = 1

    textElement.text = ""
    interval = setInterval(() => {
        if(direction == 1) {
            displayStr = displayStr + typeStrings[wordIdx][typeIdx]
            typeIdx++

            textElement.text = displayStr + endingString

            if (typeIdx === typeStrings[wordIdx].length) {
                direction = 0
            }
        }
        else{
            typeIdx--;
            displayStr = displayStr.substr(0,stringStart.length + typeIdx-1);

            textElement.text = displayStr + endingString;

            if(typeIdx == 0) {
                direction = 1
                wordIdx++
                displayStr = stringStart
                if (wordIdx === typeStrings.length) wordIdx = 0
            }
        }
    }, timeInterval)
	
}

The text elements ID is #text36, i am really new to coding and cant tell where my mistake is.
Thank you for your help!
Nicole