Replace text with JS at a given URL

0

Hello how can I do to replace some part of my link by example JS

link

I need to change the 2 "90" to "160"

    
asked by anonymous 23.03.2018 / 19:48

1 answer

0

You can use replace

let url = 'https://meusite.com.br/arquivos/ids/785837-90-90/arquivo'

let newUrl = url.replace(/90/g, '160')

console.log(newUrl)
    
23.03.2018 / 19:55