Skip to main content

Function: formatXP()

function formatXP(xp, label?): string

Formats XP with commas and custom label.

Parameters​

ParameterTypeDescription
xpnumberXP amount to format
label?stringCustom label for XP (defaults to 'XP')

Returns​

string

Formatted string with thousands separators

Example​

formatXP(1500) // Returns '1,500 XP'
formatXP(1500, 'Reputation') // Returns '1,500 Reputation'
formatXP(1500, 'Points') // Returns '1,500 Points'