LeetCode 1108. Defanging an IP Address Posted on 2021-01-18 In LeetCode 題目123Input: address = "1.1.1.1"Output: "1[.]1[.]1[.]1" 解法思維將字串分割split() 再加回去join() 1var defangIPaddr = address=> { return address.split('.').join('[.]')}; splice() 1var defangIPaddr = address=> {return address.replace(/[.]/g,'[.]')};