惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

C
Check Point Blog
Microsoft Security Blog
Microsoft Security Blog
aimingoo的专栏
aimingoo的专栏
V
V2EX
博客园 - 【当耐特】
T
Tailwind CSS Blog
Apple Machine Learning Research
Apple Machine Learning Research
量子位
MyScale Blog
MyScale Blog
Hugging Face - Blog
Hugging Face - Blog
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
月光博客
月光博客
I
InfoQ
WordPress大学
WordPress大学
Martin Fowler
Martin Fowler
T
The Blog of Author Tim Ferriss
爱范儿
爱范儿
小众软件
小众软件
罗磊的独立博客
Recent Announcements
Recent Announcements
Blog — PlanetScale
Blog — PlanetScale
J
Java Code Geeks
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC

博客园 - focus

IE浏览器自定义地址协议 -- 通过B/S程序中打开C/S程序 Html编辑器 -- TinyMCE HTML编辑器 -- HtmlArea 用 BindingSource 绑定窗体中控件不失去焦点无法更新数据源的问题 - focus asp.net 服务器控件防止重复提交表单 - focus - 博客园 html 元素的 onpropertychange 事件 c# 操作 Excel : 给单元格增加下拉选项值 动态创建大量 html dom 元素时提升性能 - focus 很黄的日期格式化。。。 - focus - 博客园 Asp.net 导出 .html,.txt 等格式的文件 ActiveReports 打印条码无法设置纸张大小? ActiveReports 代码控制报表连续打印 《JavaScript高级程序设计》读书笔记之一:几个与原始类型等价的引用类型的常用方法和属性 js:delete 操作符 js:for...in 语句(JavaScript For...In Statement) html 的 image button 自动提交 form Internet Explorer Developer Toolbar IE 最大化和最小化 js trim
js:字符串类型快速转化成数字类型和数字类型快速转化为字符串...
focus · 2007-12-20 · via 博客园 - focus

Posted on 2007-12-20 14:56  focus  阅读(1366)  评论(2)    收藏  举报

js 的变量虽然是弱类型的,
但有时候也需要对变量进行类型转化.
比如字符串类型之间的 + 操作和数字类型之间的 + 是不同的.
以下是两个简单的方法进行字符串类型和数字类型的相互转化(不需要借助任何内置方法)
string to number:
'123' --> 123 : '123' * 1
number to string:
123  --> '123': 123 + ''

刷新页面返回顶部