Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2023-06-06 19:18:04 +03:00
parent ea8ae70b01
commit 5b4366cea9

View File

@ -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