def stringToByteArray(string: str) ->list:
    """
    A port of javascript string to Bytearray function

    :param string: a string
    """
    result = []
    i = 0
    print(len(string))
    while i < len(string):
        a = ord(string[i])
        result.append((65280 & a) >> 8)
        result.append(255 & a)
        i += 1
    return result
