JavaScript http https replace

updated Oct 6, 2021created Oct 14, 2021
js
str = "http://example.com"; str = str.replace("http://", "https://"); console.log(str); // "https://example.com"

正規表現で先頭だけでも良いかも