User input in node.js

I am new to node.js and i want to take user input in terminal ,as we do in C and Java.
like in C if we want when we want to take values of array


int main()
{
    printf("enter an size of array");
    int size;
    scanf("%d",&size);
    int arr[size];
    for(int i=0;i<size;i++)
    {
        scanf("%d",&arr[i]);
    }
    for(int j=0;j<size;j++)
    {
        printf("%d\n",arr[j]);
    }
    return 0;
}
 
similarly i want the user to provide input in terminal using node.js.
is it possible to do so,i referred to node.js documentation but it helps me in getting a single user input not in getting multiple user input one after another as long the user desire

@nikhill,

I think this link will be useful: