-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvariables.js
More file actions
36 lines (27 loc) · 1.14 KB
/
variables.js
File metadata and controls
36 lines (27 loc) · 1.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
// simple string
var string = "javascript is very cool :)";
// simple array :) JS have very handfull array notation
var array = [1, 2, 3, 4, 5, 6];
console.log(array);
// the thing that you cant go without
console.log("typeof(a) -> " + typeof (a));
console.log("typeof(string) -> " + typeof (string));
console.log("typeof(array) -> " + typeof (array));
// wtf ? Object :)
// what about undefined ?
console.log("typeof(somethingMissing) -> " + typeof (somethingMissing));
console.log("typeof(undefined) -> " + typeof (undefined));
console.log("typeof(typeof(undefined)) -> " + typeof ( typeof (undefined)));
// there's null, but null is not undefined
// use null to initialize empty variables, not undefined
console.log("typeof(null) -> " + typeof (null));
// few more usefull things
var toString = "54abc";
console.log("Before parseInt :" + typeof (toString));
toString = parseInt(toString);
console.log("After parseInt :" + toString + " " + typeof (toString));
var plusInf = 1.7976931348623157E+10308;
console.log("Plus infinity : " + plusInf);
var minusInf = -1.7976931348623157E+10308;
console.log("Minus infinity: " + minusInf);
console.log(Infinity);