当前位置:网站首页>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 .
边栏推荐
- regular expression
- DHCP 动态主机设置协议 分析
- Common text processing tools
- Layer pop-up layer closing problem
- Awk of three swordsmen in text processing
- What kind of methods or functions can you view the laravel version of a project?
- 2022-07-07 Daily: Ian Goodfellow, the inventor of Gan, officially joined deepmind
- Day21 multithreading
- Leetcode skimming: binary tree 21 (verifying binary search tree)
- 货物摆放问题
猜你喜欢

MATLAB中polarscatter函数使用

共创软硬件协同生态:Graphcore IPU与百度飞桨的“联合提交”亮相MLPerf

error LNK2019: 无法解析的外部符号

飞桨EasyDL实操范例:工业零件划痕自动识别

线程池拒绝策略最佳实践

Go语言学习笔记-结构体(Struct)

Leetcode skimming: binary tree 21 (verifying binary search tree)

.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst

达晨与小米投的凌云光上市:市值153亿 为机器植入眼睛和大脑

Coscon'22 community convening order is coming! Open the world, invite all communities to embrace open source and open a new world~
随机推荐
MySQL入门尝鲜
Unity build error: the name "editorutility" does not exist in the current context
[binary tree] delete points to form a forest
Milkdown 控件图标
Users, groups, and permissions
云检测2020:用于高分辨率遥感图像中云检测的自注意力生成对抗网络Self-Attentive Generative Adversarial Network for Cloud Detection
How to reset Firefox browser
.Net下极限生产力之efcore分表分库全自动化迁移CodeFirst
What kind of methods or functions can you view the laravel version of a project?
JS function 返回多个值
【学习笔记】AGC010
自定义线程池拒绝策略
《开源圆桌派》第十一期“冰与火之歌”——如何平衡开源与安全间的天然矛盾?
PCAP学习笔记二:pcap4j源码笔记
Practical example of propeller easydl: automatic scratch recognition of industrial parts
MySQL importing SQL files and common commands
Grep of three swordsmen in text processing
Initialization script
抓细抓实抓好安全生产各项工作 全力确保人民群众生命财产安全
Sample chapter of "uncover the secrets of asp.net core 6 framework" [200 pages /5 chapters]