JavaScript http https replace

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

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