String.prototype.replaceAll

Изменения в новых версиях / ES2021

// *** before: ***
var text = "2024-06-15";
var withSlashes = text.replace(/-/g, "/"); // without /g only the first one
//changes

// *** in version ES2021: ***
const text = "2024-06-15";
const withSlashes = text.replaceAll("-", "/");