首页 > 代码库 > JavaScript_5
JavaScript_5
1. JavaScrip中所有事物都是对象:字符串、数字、日期、等等
2. 在javaScripe中,对象是拥有属性和方法的数据
<!DOCTYPE html> <html> <head> <title></title> <meta charset="utf-8" /> </head> <body> <script> var message = "Hello World!"; document.write(message.toUpperCase()+"</br>");//调用对象的方法 //申明对象 var person1 = new Object(); person1.firstname = "yoyo"; person1.lastname = "Xiao"; person1.age = 33; person1.eyecolor = "black"; var person2 = { firstname: "dodo", lastname: "He", age: 45, eyecolor: "blue" }; document.write(person1.firstname + " " + person1.lastname + " is " + person1.age + " eyes are " + person1.eyecolor); document.write(person2.firstname + " " + person2.lastname + " is " + person2.age + " eyes are " + person2.eyecolor); </script> </body> </html>
JavaScript_5
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。