I've created a popup that has a number in it. The data is being imported from a geoJSON file. Is there a way to include a comma separator? I've tried ".toLocaleString()" and ".toString()". Assistance with my syntax would be appreciated, thank you.
layers.one = L.geoJson(data, {
filter: function (feature, layer) {
return (feature.properties.list_price <= 250000);
},
// Creates popup
onEachFeature: function (feature, layer) {
// console.log(layer) // To test for function operation
layer.bindPopup(
'<h3>' +
feature.properties.full_address +
'</h3><hr><p>' +
'$' +
feature.properties.list_price.toLocaleString().replace(/B(?=(d{3})+(?!d))/g, ",")
) + '</p>'
}
})
