SOURCE

class Mac{

  constructor(char){
    if(typeof char=='string'){
      this.char = char;
    }
    
  }

  set(string){
    let right= true;
    let arr=string.split(this.char)
    if(arr.length===6){

    }else {
      console.log('length wrong')
      right=false
    }
    for(let i=0;i<arr.length;i++){
      if(arr[i].length!==2){
          console.log('address wrong')
        right=false
        break;
      }
      if(Number.parseInt(arr[i],16)){

      }else{
        console.log('address wrong')
        right=false
        break
      }
    }
    if(right){
      this.add=string
      return right
    }else {
      return right
    }

  }

  toString(){
    return this.add
  }
}

let m = new Mac('-')
let b = m.set('11-22-33-44-55-66k')
console.log(m=='11-22-33-44-55-66')
console 命令行工具 X clear

                    
>
console