求快看看 为什么没有输出结果


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        //创建构造函数Circle
        function Circle(r){
//设置对象的r属性
            this.r=r;
        }
        //给原型对象添加pi属性
        Circle.prototype.pi=3.14;
        //给原型对象添加求圆周长的circumference方法
        Circle.prototype.circumference=function(){
            return 2*this.pi*this.r;
        }
        //给原型对象添加求圆面积的area方法
        Circle.prototype.area=function(){
            return this.pi*this.r*this.r;
        }
        //创建一个新对象c,半径为12
        var c=12;
        with(c){
//输出圆的半径
            document.write("圆的半径为:"+r+"<br>");
//输出圆的周长
            document.write("圆的周长为:"+circumference()+"<br>");
//输出圆的面积
            document.write("圆的面积为:"+area()+"</br>");
        }
    </script>
 
</head>
<body>
 
</body>
</html>
 

定义了一堆Circle的属性和方法,但是却没创建这个类,只声明了一个常量 c,当然打印不出东西
改成var c=new Circle(12);
然后打印的三个参数前都加上c.