03-symbol

symbol学习

基础

  • symbol是ES6新增的一种基本数据类型
  • symbol表示一个独一无二的值,它和任何值都不相等。测试如下:



    在这里插入图片描述

symbol作为属性名

  • symbol作为对象的属性名是唯一的不会被覆盖
    在这里插入图片描述

  • symbol作为对象的属性名也无法正常被获取到
    在这里插入图片描述

  • symbol也不是完全无法获取到的,可以用一下两种办法获取

    1、使用Object.getOwnPropertySymbols()方法或对象中的symbol属性
    在这里插入图片描述
    2、使用Reflect.ownKeys()方法获取对象中包含symbol的所有属性名
    在这里插入图片描述

Symbol.for()Symbol.keyFor()

Symbol.for()

  • 使用Symbol.for()创建一个变量,它会现在全局查询是否有用同样方法创建的的同一symbol,若有就直接拿过来,没有就新创建一个
    在这里插入图片描述

Symbol.keyFor()

  • 使用Symbol.keyFor()传入使用Symbol.for()创建的symbol,返回创建时传入的标识,若传入其他的则返回undefined
    在这里插入图片描述

Symbol的内置方法(部分)

  • Symbol.hasInstance:自定义instanceof操作符在某个类上的行为
    在这里插入图片描述

  • Symbol.isConcatSpreadable:用于配置某对象作为Array.prototype.concat()方法的参数时是否展开其数组元素
    在这里插入图片描述

  • Symbol.species:允许子类覆盖对象的默认构造函数
    在这里插入图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
解决一下这个问题Traceback (most recent call last): File "D:\pythonchengxu\untitled12\zuoye.py", line 12, in <module> driver = webdriver.Chrome(options=chrome_options) File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 69, in __init__ super().__init__(DesiredCapabilities.CHROME['browserName'], "goog", File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\chromium\webdriver.py", line 92, in __init__ super().__init__( File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 270, in __init__ self.start_session(capabilities, browser_profile) File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 363, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 428, in execute self.error_handler.check_response(response) File "D:\Program Files\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 112 Current browser version is 114.0.5735.110 with binary path C:\Program Files\Google\Chrome\Application\chrome.exe Stacktrace: Backtrace: GetHandleVerifier [0x00B9DCE3+50899] (No symbol) [0x00B2E111] (No symbol) [0x00A35588] (No symbol) [0x00A5570C] (No symbol) [0x00A51471] (No symbol) [0x00A4F479] (No symbol) [0x00A81FFE] (No symbol) [0x00A81CEC] (No symbol) [0x00A7B6F6] (No symbol) [0x00A57708] (No symbol) [0x00A5886D] GetHandleVerifier [0x00E03EAE+2566302] GetHandleVerifier [0x00E392B1+2784417] GetHandleVerifier [0x00E3327C+2759788] GetHandleVerifier [0x00C35740+672048] (No symbol) [0x00B38872] (No symbol) [0x00B341C8] (No symbol) [0x00B342AB] (No symbol) [0x00B271B7] BaseThreadInitThunk [0x76847D59+25] RtlInitializeExceptionChain [0x77B6B74B+107] RtlClearBits [0x77B6B6CF+191]
06-13

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值