Water Sunlight

軽量プログラミングの文法 - JavaScript/Python

ユーザ用ツール

サイト用ツール


js:object:object

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン 両方とも次のリビジョン
js:object:object [2021/04/12 14:23]
tanaka
js:object:object [2021/04/19 14:29]
tanaka
行 19: 行 19:
 |is() <sup>[[js:top#ECMAScript|*2015]]</sup> ※|与えられたオブジェクトの比較| |is() <sup>[[js:top#ECMAScript|*2015]]</sup> ※|与えられたオブジェクトの比較|
 ※ 静的メソッド ※ 静的メソッド
-\\+\\ \\
  
-=== create()メソッド ===+===== create()メソッド =====
  
 <code javascript> <code javascript>
行 28: 行 28:
  
 === いろいろなオブジェクトの作り方 === === いろいろなオブジェクトの作り方 ===
-<code javascript>+<sxh javascript;title:Example>
 // 方法1 // 方法1
 var obj = {name:'taro', age:17}; var obj = {name:'taro', age:17};
行 42: 行 42:
     age: {value:17, writable:true, configurable:true, enumerable:true}     age: {value:17, writable:true, configurable:true, enumerable:true}
 }); });
-</code>+</sxh>
 ※詳しくは[[https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Object/create|MDN]]参照 ※詳しくは[[https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Object/create|MDN]]参照
-\\ \\+ 
 +\\
  
 ===== assign()メソッド ===== ===== assign()メソッド =====
行 52: 行 53:
 </code> </code>
  
-=== 例 === +<sxh javascript;title:Example>
-<code javascript>+
 Student1 = {name:'taro', age:17}; Student1 = {name:'taro', age:17};
 Student2 = {name:'hanako', tel:'090-1234-56789'}; Student2 = {name:'hanako', tel:'090-1234-56789'};
行 63: 行 63:
 Object.assign({}, Student1);    // taroのみコピー Object.assign({}, Student1);    // taroのみコピー
 Object.assign({}, Student1, Student1, Student2);    // taroをコピーしてhanakoをマージ Object.assign({}, Student1, Student1, Student2);    // taroをコピーしてhanakoをマージ
-</code>+</sxh>
 \\ \\
  
行 75: 行 75:
 |プロパティの追加禁止|preventExtensions(obj);|isExtensible(obj)| |プロパティの追加禁止|preventExtensions(obj);|isExtensible(obj)|
 |プロパティの追加/削除禁止|seal(obj)|isSealed(obj)| |プロパティの追加/削除禁止|seal(obj)|isSealed(obj)|
-|プロパティの追加/削除/変更禁止\\(不変オブジェクト)|freeze(obj)|isFrozen(obj)|+|プロパティの追加/削除/変更禁止 \\ (不変オブジェクト)|freeze(obj)|isFrozen(obj)|
 ※Strictモードを有効にしないと変更しようとしても例外発生しない。有効にする事を推奨 ※Strictモードを有効にしないと変更しようとしても例外発生しない。有効にする事を推奨
  
js/object/object.txt · 最終更新: 2022/01/27 13:32 by tanaka