JavaScript『Object{}』
★情報元のサイト様★
「とほほのWWW入門」http://www.tohoho-web.com/www.htm
「MDN」https://developer.mozilla.org/ja/docs/Web/JavaScript
関連タイピング
-
プレイ回数477英字615打
-
プレイ回数423英語長文220打
-
プレイ回数5938英語長文120秒
-
プレイ回数1664英語65打
-
プレイ回数2431英語60秒
-
プレイ回数165英語短文30秒
-
プレイ回数2389190打
-
プレイ回数351長文120秒
問題文
(Object)
Object
(obj={key1:value1,key2:value2})
obj={key1:value1,key2:value2}
(prototype)
prototype
(property)
property
(method)
method
(const p={os:'mac',info:function(){alert(`${this.os}`);}}; const c=Object.create(p);c.os='win';c.info();)
const p={os:'mac',info:function(){alert(`${this.os}`);}}; const c=Object.create(p);c.os='win';c.info();
(const d=new Date();Date.prototype.d1='2020'; console.log(d.d1);)
const d=new Date();Date.prototype.d1='2020'; console.log(d.d1);
(const user={name:'Nana',age:20}; Object.getPrototypeOf(user);)
const user={name:'Nana',age:20}; Object.getPrototypeOf(user);
(const p={x:7,y:8,re:function(){return this.x*this.y;}}; const c={};Object.setPrototypeOf(c,p);c.re();)
const p={x:7,y:8,re:function(){return this.x*this.y;}}; const c={};Object.setPrototypeOf(c,p);c.re();
(function p(){};const c=new p(); alert(p.prototype.isPrototypeOf(c));)
function p(){};const c=new p(); alert(p.prototype.isPrototypeOf(c));
(const obj={x:100,y:200}; console.log(Object.keys(obj));)
const obj={x:100,y:200}; console.log(Object.keys(obj));
(const obj={x:10,y:20}; console.log(Object.values(obj));)
const obj={x:10,y:20}; console.log(Object.values(obj));
(const obj={x:1,y:2}; console.log(Object.entries(obj));)
const obj={x:1,y:2}; console.log(Object.entries(obj));
(const obj=Object.fromEntries([['x',1],['y',2]]); console.log(obj);)
const obj=Object.fromEntries([['x',1],['y',2]]); console.log(obj);
(const obj={x:10,r:function(){}}; alert(Object.getOwnPropertyNames(obj));)
const obj={x:10,r:function(){}}; alert(Object.getOwnPropertyNames(obj));
(Object.getOwnPropertySymbols(obj))
Object.getOwnPropertySymbols(obj)
(const c=Object.create({x:1});c['y']=200; alert(c.hasOwnProperty('y'));)
const c=Object.create({x:1});c['y']=200; alert(c.hasOwnProperty('y'));
(const obj={};obj.key1=1; alert(obj.propertyIsEnumerable('key1'));)
const obj={};obj.key1=1; alert(obj.propertyIsEnumerable('key1'));
(const obj={};Object.defineProperty(obj,'key2',{value:2,}); console.log(obj.key2);)
const obj={};Object.defineProperty(obj,'key2',{value:2,}); console.log(obj.key2);
(Object.defineProperty (obj,'key3',{value:3,writable:true});)
Object.defineProperty (obj,'key3',{value:3,writable:true});
(Object.defineProperty (obj,'key4',{value:4,configurable:true});)
Object.defineProperty (obj,'key4',{value:4,configurable:true});
(Object.defineProperty(obj,'k5',{value:5,enumerable:true}); for(let p in obj){console.log(p);})
Object.defineProperty(obj,'k5',{value:5,enumerable:true}); for(let p in obj){console.log(p);}
(Object.defineProperty(x,'a',{get(){alert(a);return a;}, set(value){alert(value);a=value;}});x.a=1;var n=x.a;)
Object.defineProperty(x,'a',{get(){alert(a);return a;}, set(value){alert(value);a=value;}});x.a=1;var n=x.a;
(Object.defineProperties (obj,{a:{value:1,},b:{value:2},});)
Object.defineProperties (obj,{a:{value:1,},b:{value:2},});
(const obj={key8:8}; console.log(Object.getOwnPropertyDescriptor(obj,'key8'));)
const obj={key8:8}; console.log(Object.getOwnPropertyDescriptor(obj,'key8'));
(const obj={a:1}; console.log(Object.getOwnPropertyDescriptors(obj));)
const obj={a:1}; console.log(Object.getOwnPropertyDescriptors(obj));
(const obj={x:1};Object.freeze(obj); obj.x=2;console.log(obj.x);)
const obj={x:1};Object.freeze(obj); obj.x=2;console.log(obj.x);
(alert(Object.isFrozen(obj));)
alert(Object.isFrozen(obj));
(obj={x:1};Object.seal(obj); obj.y=3;obj.x=2;console.log(obj);)
obj={x:1};Object.seal(obj); obj.y=3;obj.x=2;console.log(obj);
(alert(Object.isSealed(obj));)
alert(Object.isSealed(obj));
(const obj={x:1};Object.preventExtensions(obj); obj.z=3;console.log(obj);)
const obj={x:1};Object.preventExtensions(obj); obj.z=3;console.log(obj);
(console.log(obj.constructor);)
console.log(obj.constructor);
(const tg={key1:1};const obj1={key2:2}; Object.assign(tg,obj1);console.log(tg);)
const tg={key1:1};const obj1={key2:2}; Object.assign(tg,obj1);console.log(tg);
(Object.is(123,123); Object.is(-0,0);)
Object.is(123,123); Object.is(-0,0);
(console.log(new Number(2.3).valueOf());)
console.log(new Number(2.3).valueOf());
(const x={_y:'',set y(y){alert(y);this._y=y;}, get y(){alert(this._y);return this._y;}};x.y=1;y=x.y;)
const x={_y:'',set y(y){alert(y);this._y=y;}, get y(){alert(this._y);return this._y;}};x.y=1;y=x.y;
(const a={x:2};const b={y:4,z:6}; const c={...a,...b};console.log(c);)
const a={x:2};const b={y:4,z:6}; const c={...a,...b};console.log(c);
(const{x,y,...rest}={x:2,y:4,z:6,r:8}; console.log(rest);)
const{x,y,...rest}={x:2,y:4,z:6,r:8}; console.log(rest);
(function User(n,a){this.N=n;this.A=a;} new User('Mari',20);)
function User(n,a){this.N=n;this.A=a;} new User('Mari',20);