Home > Web Front-end > JS Tutorial > body text

Example code sharing of reference objects

零下一度
Release: 2017-07-17 15:52:50
Original
905 people have browsed it
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>

<body>
<h1 id="demo1"></h1>
<h1 id="demo2"></h1>

<script>
    var person = {
        firstName: "John",
        lastName : "Doe",
        id : 5566,
        fullName : function()
        {
            return this.firstName + " " + this.lastName;
        }
    };
    document.getElementById("demo1").innerHTML = "不加括号输出函数表达式:"  + person.fullName;
    document.getElementById("demo2").innerHTML = "加括号输出函数执行结果:"  +  person.fullName();
</script>



</body>
</html>
Copy after login

The above is the detailed content of Example code sharing of reference objects. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!