vbth7777 bắt đầu chủ đề từ 2 năm trước

@HauVo ·


let string = 'hello$@#!%%'

const specialCharacters = [
    "~", "`", "!", "@", 
    "#", "$", "%", "^", 
    "&", "*", "(", ")", 
    "-", "_", "+", "=", 
    "{", "}", "[", "]", 
    "|", "\\", "/", ":", 
    ";", "\"", "'", "<", 
    ">", "?"
  ]
  let result = string

  specialCharacters.forEach(char => {
    for(let i of string){
      result = string.replace(char, '')
    }
  })

  console.log(result)

Viết câu trả lời

Drop Images

0 Bình luận