익스플로러에서 includes 대신 indexOf를 사용하자
인터넷 익스플로러는 includes를 지원하지 않는다…
변경전
1
2
3
if (str.includes("hi")) {
alert("HI!!");
}
변경후
1
2
3
if (str.indexOf("hi") >= 0) {
alert("HI!!");
}
This post is licensed under CC BY 4.0 by the author.
인터넷 익스플로러는 includes를 지원하지 않는다…
변경전
1
2
3
if (str.includes("hi")) {
alert("HI!!");
}
변경후
1
2
3
if (str.indexOf("hi") >= 0) {
alert("HI!!");
}