当前位置:网站首页>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)
}
}
边栏推荐
- C語言教師工作量管理系統
- Sliding window + monotone queue concept and example (p1886 Logu)
- Ping An technology's practice of migrating from Oracle to ubisql
- Impressive questions
- Oracle concept II
- tensorflow求解泊松方程
- Oracle概念二
- Adaoracle supports multi chain distributed Oracle with wide area node quotation
- Awk determines whether the first column is greater than 1. If it is greater than 1, the row will be printed
- Solving Poisson equation by tensorflow
猜你喜欢

Oracle概念二

Construction and management practice of ByteDance buried point data flow

Cesium realizes satellite orbit detour

Simulated process scheduling

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

Leetcode 5. Longest Palindromic Substring

Sliding window + monotone queue concept and example (p1886 Logu)
P.A.R.A 方法在思源的简易应用(亲测好用)

Related configuration commands of Huawei LACP

一个机器人位于一个 m x n 网格的左上角 。机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角。问总共有多少条不同的路径?【LeetCodeHot100】
随机推荐
#yyds干货盘点#简述chromeV8引擎垃圾回收
数据中心表格报表实现定制统计加班请假汇总记录分享
Smart wind power | Tupu software digital twin wind turbine equipment, 3D visual intelligent operation and maintenance
Impressive questions
P.A.R.A 方法在思源的简易应用(亲测好用)
Community sharing jumpserver in the eyes of senior open source users: a fortress machine for "Crazy" iteration
d3dx9_ How to repair 32.dll? d3dx9_ Solution to 32.dll missing
Cloud security daily 220216: root privilege escalation vulnerability found on IBM SaaS integration platform needs to be upgraded as soon as possible
# Cesium实现卫星在轨绕行
Redis Series 2: data persistence improves availability
Performance problems caused by redis cache invalidation and competitive loading
Oracle concept II
Adaoracle supports multi chain distributed Oracle with wide area node quotation
全面解析零知识证明:消解扩容难题 重新定义「隐私安全」
A large number of missing anchor text
关于VS2019C#如何建立登陆界面输入的用户名和密码需与Access数据库的记录相匹配
Solving Poisson equation by tensorflow
Awk determines whether the first column is greater than 1. If it is greater than 1, the row will be printed
模拟进程调度
Related configuration commands of Huawei LACP