How to make a changing status in discord.js?

I followed a tutorial for a changing status, and when i ran the bot i got this error:

                let status = arrayOfStatus(index);

TypeError: arrayOfStatus is not a function
    at Timeout._onTimeout (/home/runner/Nilex-1/index.js:16:30)
    at listOnTimeout (internal/timers.js:554:17)
    at processTimers (internal/timers.js:497:7)
repl process died unexpectedly: exit status 1

My code is:

client.on("ready", () => {
    console.log(`${client.user} has booted up!`);
    console.log(`Bot user ID: ${}`);

    let arrayOfStatus = [`over ${client.guilds.cache.size} servers/guilds!`, `myself being developed!`];

    let index = 0;
    setInterval(() => {
        if (index === arrayOfStatus.legth) index = 0;
        let status = arrayOfStatus(index);
        client.user.setActivity(status, { type: "WATCHING" }).catch(console.error);
    }, 3000);

Any help?


You may access an array element via [] and not () as mentioned by futur in his comment directly to this post, I’d like to elaborate.

What your tutorial person wanted to say was basically this:

// Making an array of status
const array = ['hello','bonjour','konichiwa']; 
/* This array has certain values 
- at array[0] being hello, 
- array [1] being bonjour and 
- array[2] being konichiwa,
 so now you may declare a variable to access them,
and further increment it as you're doing ,
well great! I'd just make it simpler and break it down for you :) */
let i = 0
setInterval(() => { // setInterval function to pass in a timeout for changing
                if (i == array.legth) index = 0; // says if index reaches 2 then reset the value of i so we can go to the first status from last again 
                let status = array[i] // states let status be the ith value of the array 
                client.user.setActivity(status); // setting the status :)
                i++; // adding one ( incrementing ) the variable i so we can move to the next status!
        }, 3000) // timeout ( would change status every 3 seconds )