Yanfly Durability Help

Is there a way to display the turn player's equipped weapon durability ?? I wanted to allow players to check their weapons durability depending on who's turn it is. How can I do the following in a show message:

<script that shows weapon Yanfly image>
Current Weapon: <script that shows weapons name>
Sharpness: <script that shows its durability>
Hello! Can be done like this:
Code:
let mainWeapon = target.equips()[0];
let text = '';
if (mainWeapon) {
  let name = mainWeapon.name;
  let iconIndex = mainWeapon.iconIndex;
  let durability = mainWeapon.durability
  text = 'Current Weapon: ' + '\\i[' + iconIndex + ']' + name + '\n' + 'Sharpness: ' + durability;
} else {
  text = 'Current Weapon:  No weapon'
}
$gameMessage.add(text)
@TSR Where do I use this? I wanted a skill that would be able to display this information
Hello again. You can use it anywhere a script can be read...
For a skill, you could use it in a <Before Eval> Notetag of Yanfly Skill_Core.
Hello again. You can use it anywhere a script can be read...
For a skill, you could use it in a <Before Eval> Notetag of Yanfly Skill_Core.
PixiJS 4.5.4 - ✰ WebGL ✰ http://www.pixijs.com/ ♥♥♥


/C:/Users/z/Desktop/PhantasyFrontier/GAME/js/plugins/YEP_EventCopier.js:431 BEFORE EVAL ERROR
/C:/Users/z/Desktop/PhantasyFrontier/GAME/js/plugins/YEP_EventCopier.js:432 let mainWeapon = target.equips()[0];
let text = '';
if (mainWeapon) {
let name = mainWeapon.name;
let iconIndex = mainWeapon.iconIndex;
let durability = mainWeapon.durability
text = 'Current Weapon: ' + '\\i[' + iconIndex + ']' + name + '\n' + 'Sharpness: ' + durability;
} else {
text = 'Current Weapon: No weapon'
}
$gameMessage.add(text)

/C:/Users/z/Desktop/PhantasyFrontier/GAME/js/plugins/YEP_EventCopier.js:433 SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

I got that error
Thank you so much!
Replace each let with var.
Thanks people, @Maliki79 , is there a way to add this into an Action Sequence? Wanted the Swing Attack animation to play then it shows the message but it doesn't seem to work
I have very little experience with the action sequences.
You can start with trying to get a message to show.

You can build off of what TSR said and try

$gameMessage.add("test quote");

Somewhere in the sequence and see if it shows up.

If it does then you can just work on getting the data you need shown.

EDIT: So two things:

1. I got the code I suggested to work.
Just use
eval: $gameMessage.add("Testing");
in the correct spot in the sequence.

That said,

2. You can try this site:
To play with the code for action sequences

Original thread: https://forums.rpgmakerweb.com/threads/yanfly-durability-help.120103/