TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

JavaScript handler isExtensible() Method

JavaScript handler isExtensible() Method with examples on javascript handler, javascript methods, javascript tutorial, apply(), construct(), defineProperty(), deleteProperty(), get(), setPrototypeOf(), set(), ownKeys(), isExtensible() etc.

<< Back to JAVASCRIPT

JavaScript handler.isExtensible() Method

The handler.isExtensible() method a trap for Object.isExtensible(). We can be mostly used for logging or auditing calls to Object.isExtensible (determine if an object is "extensible").

Syntax

isExtensible: function(target)

Parameters

target: The target object.

Return value

Return a Boolean value.

Browser Support

Chrome Compatibility unknown
Edge Compatibility unknown
Firefox 31
Opera Compatibility unknown

Example 1

var x = { foo: 1 };
var proxy = new Proxy(x, {
  isExtensible: function(target) {
    document.writeln('in isExtensible');
    //expected output: in isExtensible 
 return Object.isExtensible(target);
  }
});
document.writeln(Object.isExtensible(proxy));
//expected output: true 
document.writeln("
") Object.preventExtensions(proxy); document.writeln(Object.isExtensible(proxy)); //expected output: false
Test it Now

Output:

in isExtensible true 
in isExtensible false

Example 2

const pro={
too:1 }
const  proxy = new Proxy(pro, {
  isExtensible: function(target) {
    document.writeln(' in value : ');
    return true;
  }
});

document.writeln(Object.isExtensible(proxy));
//expected output: in value : true
Test it Now

Output:

in value : true 

Example 3

var a = {
  canEvolve: true
};
var b = { 
  isExtensible(target) {
    return true;
  },
   };
const proxy1 = new Proxy(a, b);
document.writeln(Object.isExtensible(proxy1));
// expected output: true
Test it Now

Output:

true

Next TopicJavaScript handler




Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf