Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[js] 第65天 说说你对数据类型转换的理解是什么?类型转换的方法有哪些? #298

Open
haizhilin2013 opened this issue Jun 19, 2019 · 6 comments
Labels
js JavaScript

Comments

@haizhilin2013
Copy link
Collaborator

第65天 说说你对数据类型转换的理解是什么?类型转换的方法有哪些?

@haizhilin2013 haizhilin2013 added the js JavaScript label Jun 19, 2019
@AnsonZnl
Copy link
Contributor

这个题有点大,,,写几个常用的吧

String to Number

  1. Number(str)
  2. +str

Number to String

  1. toString(num)
  2. ''+num

All to Boolean

  1. Boolean(value)
  2. !!value

Object to JSON

JSON.striingify(obj)

JSON to Object

JSON.parse(obj)

@forever-z-133
Copy link

曾写过两篇博客,整理得挺不好的,将就着看吧。
forever-z-133/others#134

@yxkhaha
Copy link

yxkhaha commented Jun 20, 2019

  • 数据类型的转换有显式转换和隐式转换
  • 显式转换: number() parseInt() parseFloat()
  • 隐式转换: + ++ * *= +=

@HuaRongSAO
Copy link

显示转化:Boolean,Number,String, parseInt,parseFloat, toString, JSON.stringify
隐式转换:运算符号, 流程控制(if,while)

@MrZ2019
Copy link

MrZ2019 commented Jan 4, 2021

显示转化:Boolean,Number,String, parseInt,parseFloat, toString, JSON.stringify
隐式转换:运算符号, 流程控制(if,while)

@xiaoqiangz
Copy link

显示转化:Boolean,Number,String, parseInt,parseFloat, toString, JSON.stringify 隐式转换:运算符号, 流程控制(if,while)

mark

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
js JavaScript
Projects
None yet
Development

No branches or pull requests

7 participants