Typ hodnoty javascript

Príklady kódu

12
0

N

typeof("string"); //string
typeof(123); //number
5
0

N

// get type of variable

var number = 1
var string = 'hello world'
var dict = {a: 1, b: 2, c: 3}

console.log(typeof number) // number
console.log(typeof string) // string
console.log(typeof dict)   // object
2
0

N

typeof operando
1
0

N

// You can use the built-in method 'typeof' in order to check the variable datatype

//examples:

typeof "hello" // "string"

//or
var a = 1;
typeof(a);
//the output will be > 'number'
0
0

N

> typeof "foo"
"string"
> typeof true
"boolean"
> typeof 42
"number"

Podobné stránky

Podobné stránky s príkladmi

V iných jazykoch

Táto stránka je v iných jazykoch

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................