04.quiz
์ฐธ์กฐ์์น๋ ๊ทธ๋๋ก ๋๊ณ ์์ ์๋ ๋ด์ฉ์ ๋น์ฐ๊ธฐ
var something = [1, 2, 3, 4, 5];
something.length = 0;๊ฒฐ๊ณผ๋?
var a = {};
var output = {function() {
delete x;
return x;
}}();
console.log(a);delete๋ ๊ฐ์ฒด์์ key, value๋ฅผ ์ง์ธ๋ ์ฌ์ฉํ๋ค. ์ฉ๋๊ฐ ์๋ชป์ฐ์ฌ์ ธ ์๋ค.
๊ฒฐ๊ณผ๋?
var Employee = {
company: 'xyz'
}
var emp1 = Object.create(Employee);
// emp1 = {}
// __proto__ : company: 'xyz';
delete emp1.company;
// emp1์ ์๋ company๋ฅผ ์ง์ธ๋ ค๊ณ ํ๋๋ฐ emp1์ ์๊ธฐ ๋๋ฌธ์ด๋ค.
// delete emp1.__proto__.company
// ์ด๋ ๊ฒ ํ๋ฉด Employee์ ์๋๊ฒ ์ง์์ง๋ค. ์๋ฆ..
console.log(emp1.company);๊ฐ์ฒด ๋ง๋ค๊ธฐ
'new' ํค์๋
์ค๋ธ์ ํธ ๋ฆฌํฐ๋ด {}
Object.create();
this๊ฐ ๋ฌด์์ธ๊ฐ?
What will be logged?
Last updated
Was this helpful?