const days = '2021-10-25' function ableDay(days) { let ableDate = '' let sino = ['年','月','日'] for(let i = 0; i < 3; i++) { ableDate += days.split('-')[i]+sino[i] } return ableDate } console.log(ableDay(days)) console.log(days.replace(/-/g, '/'))