• 06 扩展的对象的功能


    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
        <script>
            //es6直接写入变量和函数,作为对象的属性和方法
            // const name = 'walter',age = 20;
            // const person = {
            //     name,
            //     age,
            //     sayName(){
            //         console.log(this.name)
            //     }
            // }
            // person.sayName()
            //
            // function fn(x,y) {
            //     return {x,y}
            // }
            // console.log(fn(10,20))//x: 10 y: 20



            //直接写入变量和函数,设置和获取选择器
            // let cart = {
            //     wheel:4,
            //     set(newVal){
            //         if (newVal < this.wheel){
            //             throw new Error('轮子数太少了')
            //         }
            //         this.wheel = newVal;
            //     },
            //     get(){
            //         return this.wheel;
            //     }
            // }
            // cart.set(6)

            const obj = {};
            obj.isShow = true;
            const name = 'a';
            obj[name+'bc'] = 123;
            console.log(obj);



            //对象的方法
            //is() === 比较两个值是否严格相等
            console.log(Object.is(NaN,NaN))//true

            //assign() 对象的合并  Object.assign(新对象,被合并对象1,被合并对象2)
            let newObj = Object.assign({},{a:1},{b:2})
            console.log(newObj)//{a: 1, b: 2}

        </script>
    </body>
    </html>
  • 相关阅读:
    redis状态与性能监控
    redis-stat 安装
    Redis-stat is not found
    查看Redis信息和状态
    查看、分析memcached使用状态
    Memcache内存分配策略
    memcached server LRU 深入分析
    Memcached常用命令及使用说明
    Web-超大文件上传-如何上传文件-大文件上传
    PHP-超大文件上传-如何上传文件-大文件上传
  • 原文地址:https://www.cnblogs.com/wuhui1222/p/14202533.html
Copyright © 2020-2023  润新知