Javascript 变量类型(字节)

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/1913194/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-22 21:52:52  来源:igfitidea点击:

Javascript variable type (byte)

javascriptvariablestypesbyte

提问by Dodo

I searched for javascript byte type variables and I can't find byte type variable???

我搜索了 javascript 字节类型变量,但找不到字节类型变量???

Thanks.

谢谢。

回答by morsanu

There is no byte predefined type in javascript.

javascript 中没有字节预定义类型。

click this link for Javascript types, detailed

单击此链接获取 Javascript 类型,详细信息

the above link is dead, here's a new one

上面的链接已经死了,这是一个新的

回答by Pacerier

JavaScript now supports raw binary data types (byte).

JavaScript 现在支持原始二进制数据类型(字节)。

Look into ArrayBuffer.

查看ArrayBuffer

回答by scribblemaniac

I think this is what you want:

我认为这就是你想要的:

var x = "A String"
var y = 42
alert("var x is " + typeof(x))
alert("var y is " + typeof(y))

This uses the javascript typeof() operator to detect what kind of type is variable x and y.

这使用 javascript typeof() 运算符来检测变量 x 和 y 的类型。

回答by Itay Maman

Javascript is a dynamically typed language. This means that variables do not have type. You declare a variable using the var keyword, as in: "var x;" and it can hold any value: date, string, integer, whatever.

Javascript 是一种动态类型语言。这意味着变量没有类型。使用 var 关键字声明一个变量,如:“var x;” 它可以保存任何值:日期、字符串、整数等等。