classTest(){
    var name,sex,age;
    
this.setName=function(x){
        name
=x;
    }
    
this.setSex=function(x){
        sex
=x;
    }
    
this.setAge=function(x){
        age
=x;
    }
    
this.getName=function(){
        
return name;
    }
    
this.getSex=function(){
        
return sex;
    }
    
this.getAge=function(){
        
return age;
    }
}

var person=new classTest();
person.setName(
"毛凌志");
person.setSex(
"");
person.setAge(
27);

alert(person.getName()
+"\n"+person.getSex()+"\n"+person.getAge())
//]]>
</script>
</body>
</html>

 

js中的正则

 var re=new RegExp('(^| )'+"te"+'( |$)');
 alert(re.test("abc te"));

 

相关文章:

  • 2021-11-06
  • 2022-01-18
  • 2022-12-23
  • 2021-10-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-11-30
  • 2021-07-22
  • 2022-12-23
  • 2021-07-26
  • 2022-03-03
  • 2022-01-19
  • 2021-05-19
相关资源
相似解决方案