随便看了看JavaScript的基础,因为基础都挺简单,就直接用我们程序员最熟悉的打招呼方式来进行第一次的输出。
还是个菜鸟,如果有格式上的问题或者不正确之处还望看客能不吝赐教!谢谢!
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<p id = "demo0"></p>
<p id = "demo1"></p>
<script>
var person = {
firstName: "hello",
lastName : "world",
};
document.getElementById("demo0").innerHTML =
person.firstName + " " + person.lastName + "!";
var person = {
firstName: "hello",
lastName : "world",
fullName : function()
{
return this.firstName + " " + this.lastName + "!";
}
};
var x = person.firstName.length
var y = person.lastName.length
var z = x + y + 2
document.getElementById("demo1").innerHTML = person.fullName();
document.write("<p>" + "字符串长度为:" + z + "</p>");
</script>
</body>
</html>