当前位置:网站首页>Why can basic data types call methods in JS
Why can basic data types call methods in JS
2022-07-07 13:08:00 【Dax1_】
problem
Why? string This basic data type can call methods , for example ‘a’.indexOf('a')
, Isn't method invocation the ability of an object ?
answer
- JS In order to facilitate the operation of basic data types , Provides 3 Special reference types :Boolean、Number、String, They have basic types of special behaviors
- actually , Whenever you read a basic type ,JS Internally, a basic wrapper type object is automatically created , Let's call some methods
'a'.indexOf('a')
In the calling process, you will firstlet str = new String('a')
, And then call indexOf, After calling, makestr = null
, Destroy the object .
边栏推荐
- Find ID value MySQL in string
- Analysis of DHCP dynamic host setting protocol
- Cinnamon 任务栏网速
- ClickHouse(03)ClickHouse怎么安装和部署
- 【学习笔记】zkw 线段树
- [untitled]
- . Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
- Aosikang biological sprint scientific innovation board of Hillhouse Investment: annual revenue of 450million yuan, lost cooperation with kangxinuo
- 云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
- ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
猜你喜欢
Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
[untitled]
MATLAB中polarscatter函数使用
智云健康上市:市值150亿港元 SIG经纬与京新基金是股东
详细介绍六种开源协议(程序员须知)
.Net下極限生產力之efcore分錶分庫全自動化遷移CodeFirst
Go语言学习笔记-结构体(Struct)
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~
ISPRS2021/遥感影像云检测:一种地理信息驱动的方法和一种新的大规模遥感云/雪检测数据集
Awk of three swordsmen in text processing
随机推荐
服务器到服务器 (S2S) 事件 (Adjust)
[untitled]
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
Session
JS function 返回多个值
红杉中国完成新一期90亿美元基金募集
What are the benefits of ip2long?
ORACLE进阶(五)SCHEMA解惑
[untitled]
[learn microservice from 0] [01] what is microservice
学习突围2 - 关于高效学习的方法
. Net ultimate productivity of efcore sub table sub database fully automated migration codefirst
迅为iTOP-IMX6ULL开发板Pinctrl和GPIO子系统实验-修改设备树文件
共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
谷歌浏览器如何重置?谷歌浏览器恢复默认设置?
Leetcode skimming: binary tree 21 (verifying binary search tree)
Find ID value MySQL in string
COSCon'22 社区召集令来啦!Open the World,邀请所有社区一起拥抱开源,打开新世界~