Water Sunlight

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

ユーザ用ツール

サイト用ツール


js:object:object

差分

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

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

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
最新のリビジョン 両方とも次のリビジョン
js:object:object [2021/04/12 14:25]
tanaka [不変オブジェクト]
js:object:object [2021/04/19 14:29]
tanaka
行 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>
 \\ \\
  
js/object/object.txt · 最終更新: 2022/01/27 13:32 by tanaka