Writing JS for a Photoshop script to automatically rename artboards

I’m trying to write JS to automatically rename artboards based on their width and height.

For example if I create an artboard that’s 500x500px, I’d like it to automatically rename to 500x500jpg100%.

I’ve tried all sorts of snippets of code but nothings quite right.

Any help would be massively appreciated!