<html>
<body>
<script>
function Dog(n,b,a){
this.name=n;
this.getBreed=function(){
return b;
}
this.getAge=function(){
return a;
}
}
var dog1=new Dog("똘망이","씨추",10);
document.write(dog1.name);
document.write(dog1.getBreed());
document.write(dog1.getAge());
var dog2=new Dog("뚱돌이","페키니즈",5);
document.write(dog2.name);
document.write(dog2.getBreed());
document.write(dog2.getAge());
</script>
</body>
</html>
'개발하자 > 자바스크립트' 카테고리의 다른 글
concat (0) | 2015.02.24 |
---|---|
Math.ceil(Math.random() * 5); (0) | 2015.02.24 |
자바스크립트 달력만들기!! (0) | 2015.02.18 |
request ,session,application (0) | 2015.02.17 |
setTimeout(1회호출)을 이용하여 한글자씩 증가or감소시키기 (0) | 2015.02.17 |