当前位置:网站首页>Part 31 supplement (31) ECMAScript conversion to string and number
Part 31 supplement (31) ECMAScript conversion to string and number
2022-06-27 16:59:00 【Embedded workplace】
1、 Convert to string
// Convert to string// If no cardinality is specified ,toString() All output in decimal system ;
2、 Convert to numbers
// Convert to numbers//parseInt(): Convert the value to an integer ;//parseFloat(): Convert a value to a floating point number ;// Both methods can only be used for String type , Return values of other types are NaN;
3、 Code
import QtQuick 2.9
import QtQuick.Window 2.2
Window {
visible: true
width: 640
height: 480
Component.onCompleted: {
// Convert to string
// If no cardinality is specified ,toString() All output in decimal system ;
var name = "fjf"
console.log(name.toString())
var age = 22
console.log(age.toString(2))
var isIf = false
console.log(isIf.toString())
// Convert to numbers
//parseInt(): Convert the value to an integer ;
//parseFloat(): Convert a value to a floating point number ;
// Both methods can only be used for String type , Return values of other types are NaN;
var num1 = parseInt("3.1415")
console.log(num1)
var num2 = parseFloat("3.1415")
console.log(num2)
}
}
边栏推荐
- 鴻蒙發力!HDD杭州站·線下沙龍邀您共建生態
- 字节跳动埋点数据流建设与治理实践
- IDE Eval reset unlimited trial reset
- 阿里云刘珅孜:云游戏带来的启发——端上创新
- Adaoracle supports multi chain distributed Oracle with wide area node quotation
- Impressive questions
- Use pyinstaller to package py files into exe. Precautions and error typeerror:_ get_ sysconfigdata_ name() missing 1...‘ check_ Solutions to exists'
- Yyds dry inventory brief chrome V8 engine garbage collection
- What are the password requirements for waiting insurance 2.0? What are the legal bases?
- Mobile terminal click penetration
猜你喜欢

10分钟掌握mysql的安装步骤

EMQ 助力青岛研博建设智慧水务平台

Bit. Store: long bear market, stable stacking products may become the main theme

When the publish / subscribe mode encounters NET
![[fxcg] today's market analysis](/img/97/fc6faa5ab693e383f085b407ce1d85.jpg)
[fxcg] today's market analysis

Use pyinstaller to package py files into exe. Precautions and error typeerror:_ get_ sysconfigdata_ name() missing 1...‘ check_ Solutions to exists'

Related configuration commands of Huawei LACP

当发布/订阅模式遇上.NET

一个机器人位于一个 m x n 网格的左上角 。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。问总共有多少条不同的路径?【LeetCodeHot100】

Etcd visualization tool: kstone deployment (I), rapid deployment based on Helm
随机推荐
EMQ 助力青岛研博建设智慧水务平台
What is the level 3 password complexity of ISO? How often is it replaced?
C语言教师工作量管理系统
The European unified charging specification act was passed before the end of the year, and it is planned to expand to products such as laptop and keyboard
Handling of difficult and miscellaneous problems during the installation and configuration of qt5.5.1 desktop version (configuring arm compilation Kit)
Synchronization mechanism of dual namenodes
Ti Click: quickly set up tidb online laboratory through browser | ti- team interview can be conducted immediately
国家食品安全风险评估中心:不要盲目片面追捧标签为“零添加”“纯天然”食品
C système de gestion de la charge de travail des enseignants en langues
黑马程序员-软件测试基础班-02-30-45工具代开浏览器运行代码,音、视频、测试点,音视频标签,布局标签。超链接语法进阶,绝对路径,相对路径
C语言集合运算
C language set operation
Practice of constructing ten billion relationship knowledge map based on Nebula graph
Missing d3d10 How to repair DLL files? Where can I download d3d10.dll
Simulated process scheduling
Qt5 signal and slot mechanism (demonstrate the correlation between the control's own signal and slot function)
字节跳动埋点数据流建设与治理实践
Mobile terminal click penetration
Hung - Mung! HDD Hangzhou station · salon hors ligne vous invite à construire l'écologie
# Cesium实现卫星在轨绕行