Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js instanceof

let literalString = 'This is a literal string';
let stringObject  = new String('String created with constructor');

literalString instanceof String;  // false, string primitive is not a String
stringObject  instanceof String;  // true

literalString instanceof Object;  // false, string primitive is not an Object
stringObject  instanceof Object;  // true

stringObject  instanceof Date;    // false
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #instanceof
ADD COMMENT
Topic
Name
2+5 =