2020년 1월 8일 복기

Ji Taek Lim·2021년 1월 8일
0

어저께 정리한걸을 어제 블로그에 계속 쓰다가..

여기에 다시 정리한다..

  it('rest/spread 문법을 객체 분해에 적용할 수 있습니다 #1', () => {
    const student = { name: '최초보', major: '물리학과' }
    const { name, ...args } = student

    expect(name).to.eql('최초보')
    expect(args).to.eql({major: '물리학과'})
  })

이건 뭔가..

    expect(args).to.eql({major: '물리학과'})

이거는 뭔지?

또 코플릿을 풀고있다..

19_extend

어렵다. 레퍼런스는 너무 쉽게 풀었다. 나는 하나씩 해볼 예정.

function extend(obj1, obj2) {
  
  let newObj ={};
  for(let key in obj1) {
    newObj[key]= obj1[key]
  }
  return newObj;
}
일단 새로 객체를 만든다.

Array.prototype.includes()

Array.prototype.includes()

const array1 = [1, 2, 3];

console.log(array1.includes(2));
// expected output: true

const pets = ['cat', 'dog', 'bat'];

console.log(pets.includes('cat'));
// expected output: true

console.log(pets.includes('at'));
// expected output: false

arr.includes(valueToFind[, fromIndex])

profile
임지택입니다.

0개의 댓글