<html> 
<head> <meta name="generator" content=
"HTML Tidy for Windows (vers 25 March 2009), see www.w3.org"> 
<script type="text/javascript">
    function person(name, age) {
        this.name = name;
        this.age = age;
    }

    var bucky = new person ("Bucky Roberts, 24");
    var Taylor = new person (Taylor Swift, 20");
</script>
</head> 
<body> 
<script type = "text/javascript">
    document.write(taylor.age);
</script> 
</body>
</html>

Recommended Answers

All 4 Replies

Javascipt seems to work in other computers besides mine. It is enabled in browser. Anyone want to remotely help?

You use Taylor in line 11 and taylor in line 16.
Also, lines 10, 11 have errors. Strange quote marks there.
I didn't check for anything else.

Member Avatar for diafol

Not a browser issue - it's your code. There are many errors in it. Taylor vs. taylor and use of quotes all over the place.

Please try following code, hope this will help:

<html>

<head>
    <meta name="generator" content="HTML Tidy for Windows (vers 25 March 2009), see www.w3.org">
    <script type="text/javascript">
        function person(name, age) {
            this.name = name;
            this.age = age;
        }
        var bucky = new person("Bucky Roberts", 24);
        var Taylor = new person("Taylor Swift", 20);
    </script>
</head>

<body>
    <script type="text/javascript">
        document.write(Taylor.age);
    </script>
</body>

</html>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.