Skip to content

Commit 4df62ec

Browse files
hemanthscottgonzalez
authored andcommitted
Testing Types: Added few more types.
1 parent be8e146 commit 4df62ec

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

page/javascript-101/testing-type.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,18 @@ var myObject = {
2121
var myArray = [ "a", "b", "c" ];
2222
var myString = "hello";
2323
var myNumber = 3;
24+
var myRegExp = /(\w+)\s(\w+)/;
2425
2526
typeof myFunction; // "function"
2627
typeof myObject; // "object"
2728
typeof myArray; // "object" -- Careful!
2829
typeof myString; // "string"
2930
typeof myNumber; // "number"
3031
typeof null; // "object" -- Careful!
32+
typeof undefined; // "undefined"
33+
typeof meh; // "undefined" -- undefined variable.
34+
typeof myRegExp; // "function" or "object" depending on environment.
35+
3136
3237
if ( myArray.push && myArray.slice && myArray.join ) {
3338
// probably an array (this is called "duck typing")

0 commit comments

Comments
 (0)