题解 | #Getter#

Getter

https://www.nowcoder.com/practice/e7f3a2f429d945e49f5b48ef1065beda

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

    <script>
        class Rectangle {
            // 补全代码

            constructor(height, width) {
                this.height = height;
                this.width = width;
            }
            get area() {
                return this.Calcarea();
            }
            Calcarea() {
                return this.height * this.width;
            }
        }

        console.log(new Rectangle(12, 12).area)

    </script>
</body>

</html>

全部评论

相关推荐

_mos_:我以为手抄报简历就已经很顶了,没想到还有表格简历
点赞 评论 收藏
分享
程序员饺子:正常 我沟通了200多个 15个要简历 面试2个 全投的成都的小厂。很多看我是27直接不会了😅
点赞 评论 收藏
分享
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务