Object.isExtensible()【拡張(プロパティ追加)可否】メソッド

メモ

構文

  • Object.isExtensible ( O )

  • O:オブジェクト

  • 拡張(プロパティ追加)可否 (true:拡張可 / false:拡張不可)
  • false:入力のOがオブジェクト以外

TypeError 例外:O がオブジェクト以外

var point = { x:0, y:0 };
console.log(Object.isExtensible(point));  // true
Object.preventExtensions(point);
console.log(Object.isExtensible(point));  // false

関連