How to pass an array into a function without using vectors in emscription?

  c++, emscripten, javascript, webassembly

I’ve looked basically everywhere, and I can’t find any documentation about this question. I want to pass a JS array as a C-array in em++, and everything I’ve found uses vectors. With vectors, you have to push back every value one by one then pass it into the C++ function. This is slow and really inconvenient, so I’d like to know of a normal C-array way of doing this.
For context, I want to do something like this:

int
add(const int test[], const int size)
{
    int res = 0;
    for (int i = 0; i < size; i++)
        res += test[i];
    return res;
};

Source: Windows Questions C++

LEAVE A COMMENT