JavaScript数据类型
Posted freeengles
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了JavaScript数据类型相关的知识,希望对你有一定的参考价值。
/**
* Created by Jeco on 2018/11/27.
*/
var a
a = \'a\'
console.log(typeof (a))
console.log(a)
var num1 =10;
var num2=10;
var sum = num1 + num2 ;
//把sum自动转换成字符串做拼接
console.log("sum =" +sum)
================================================================
var a
a = \'a\'
console.log(typeof (a))
console.log(a)
var num1 =10;
var num2=10;
var sum = num1 + num2 ;
console.log("sum =" +sum)
var num3 = Infinity-1
var num4= NaN
console.log(num3)
var a =\'123\'
var num5=parseInt(a)
=====================================
var str1 = "sunck"
// 字符相加
console.log(str1+"!!")
console.log(typeof(str1))
=============================
var a = "123"
var num = parseInt(a)
console.log(typeof (num))
=================================
var num = parseInt(prompt("qing shuru "))
console.log(num)
var num1 =10;
var num2 = 10;
//先赋值后++
console.log(num1++)
console.log(num1)
++num2
console.log(++num2)
console.log(num2)
以上是关于JavaScript数据类型的主要内容,如果未能解决你的问题,请参考以下文章
VSCode自定义代码片段12——JavaScript的Promise对象