JavaScript_5
Posted HepburnXiao
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了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的主要内容,如果未能解决你的问题,请参考以下文章
JavaScript - 代码片段,Snippets,Gist
VSCode自定义代码片段12——JavaScript的Promise对象