SOURCE

function ponitValueFormat(values,maxVal = 1e4)
{
    if(values<maxVal)
    {
        return values;
    }
    let val =  parseFloat(values/maxVal);        
    return parseInt(val) == val ? `${val}W`:`${val.toFixed(2)}w`;
   
}


console.log(ponitValueFormat(2.212e4));
console 命令行工具 X clear

                    
>
console