mirror of
https://github.com/flynx/Course-JavaScript.git
synced 2025-10-28 18:40:08 +00:00
docs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ea8ae70b01
commit
5b4366cea9
@ -85,7 +85,7 @@
|
||||
|
||||
// Type checking
|
||||
//
|
||||
|
||||
typeof(42) // -> 'number'
|
||||
|
||||
|
||||
|
||||
@ -95,6 +95,21 @@
|
||||
|
||||
// Type cheking
|
||||
//
|
||||
// Here thesame approach as for simple types is not productive:
|
||||
|
||||
typeof([42]) // -> 'object'
|
||||
typeof({}) // -> 'object'
|
||||
|
||||
// so a better approach would be to:
|
||||
|
||||
[42] instanceof Array // -> true
|
||||
|
||||
// but since all objects are objects the test can get quite generic (XXX)
|
||||
|
||||
[42] instanceof Object // -> true
|
||||
{} instanceof Object // -> true
|
||||
|
||||
|
||||
|
||||
|
||||
// Prototypes and inheritance
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user