声明下面两个,怎么感觉输出是一样的啊
var num1 = 10;var num1 = "10";
What is the difference between var num1 = 10; and var num1 = "10";? - PHP Chinese website Q&A - What is the difference between var num1 = 10; and var num1 = "10";? - PHP Chinese website Q&A
Take a look around Oh, study it.
你声明的变量var num1=10;里的10是number也就是数字,而var num='10'里的10是字符串
可以使用后面章节中的将要介绍的typeof来输出下变量的类型,就会清楚了。
复制下面两条语句到程序中运行看一下
alert(typeof(num1));
alert(typeof(num2));
What is the difference between var num1 = 10; and var num1 = "10";? - PHP Chinese website Q&A - What is the difference between var num1 = 10; and var num1 = "10";? - PHP Chinese website Q&A
Take a look around Oh, study it.
你声明的变量var num1=10;里的10是number也就是数字,而var num='10'里的10是字符串
可以使用后面章节中的将要介绍的typeof来输出下变量的类型,就会清楚了。
复制下面两条语句到程序中运行看一下
alert(typeof(num1));
alert(typeof(num2));