Leetcode Algorithm 1108

박영호·2021년 3월 25일

1108 Defanging an IP Address

Example 1

Input: address = "1.1.1.1"
Output: "1[.]1[.]1[.]1"

Example 2

Input: address = "255.100.50.0"
Output: "255[.]100[.]50[.]0"

result

var defangIPaddr = function(address) {
    return address.replace(/\./g, "[.]")      
};
profile
무언가에 호기심이 생기면 적극적이고 재밌게 그걸 해결해내고 싶어하는 프론트 엔드 개발자 입니다 .

0개의 댓글