欢迎您 本站地址:
复制网址
手机查看
切换背景
源代码:
html编辑器
颜色值转换
点击运行
小库网 <h2>JavaScript 对象</h2> <p id="demo"></p> <script> function Person(first, last, age, eye) { this.firstName = first; this.lastName = last; this.age = age; this.eyeColor = eye; } var myFather = new Person("John", "Doe", 50, "blue"); var myMother = new Person("Sally", "Rally", 48, "green"); document.getElementById("demo").innerHTML = "我的父亲年龄是 " + myFather.age + "。我的母亲年龄是 " + myMother.age; </script>
运行结果:
小库提示
扫描下方二维码,访问手机版。
打赏
关闭