Storing a Character's EXP to level data in a variable

Hello,

In RPG Maker MZ, I have been trying for a while to figure out how to use a script that pulls the data for a character and store it in a variable for the EXP required to next level. The best I got was this:

$gameVariables.setValue(19, $gameParty.members()[n].nextRequiredExp())

The 19 is the variable, and I am trying to figure out where I put the character's number that I am looking for. But I have placed it all over but it doesn't seem to work. I'm guessing this code is wrong somehow, but I don't have the knowledge to fix it. Can anyone help, please!

Thanks!
I feel this is closer:

$gameVariables.setValue(19, $data.actors[10].nextRequiredExp())
JavaScript:
// Replace "n" with 0 to get the exp required for the first party member
// 1 - Is the second party
// 2 - Is the third party member
// ...etc.
$gameParty.members()[0].nextRequiredExp()

// Or if you want to target a specific actor you can use something like this:
// Just replace "1" with the id of your actor from the database.
$gameActors.actor(1).nextRequiredExp()
JavaScript:
// Replace "n" with 0 to get the exp required for the first party member
// 1 - Is the second party
// 2 - Is the third party member
// ...etc.
$gameParty.members()[0].nextRequiredExp()

// Or if you want to target a specific actor you can use something like this:
// Just replace "1" with the id of your actor from the database.
$gameActors.actor(1).nextRequiredExp()
Thank you! That's what I was missing, it is $gameActors.actor and not dataActor.

Original thread: https://forums.rpgmakerweb.com/threads/storing-a-characters-exp-to-level-data-in-a-variable.166113/