Code Monkey home page Code Monkey logo

Comments (2)

Heojiyeon avatar Heojiyeon commented on August 21, 2024

Q1. 출력 결과와 그 이유를 작성해주세요.

const set = new Set([1, 2, 3]);

set.size = 10;
console.log(set.size); // ?
정답
3, size 프로퍼티는 setter함수 없이 getter 함수만 존재하는 접근자 프로퍼티로, size 프로퍼티에 숫자를 할당하여 set 객체의 요소 개수를 변경할 수 없다.

from js-deep-dive-study.

SDWoo avatar SDWoo commented on August 21, 2024

Q1. 해당 배열을 중복없이 정렬해보시오!

const arr = [8,7,6,5,7,8,9,3,2,4,1];
console.log(answer); // -> [1, 2, 3, 4, 5, 6, 7, 8, 9]
정답
[... new Set(arr)].sort((a,b)=> a-b) => 스프레드 문법과 Set을 통해 중복을 제거한 후 정렬한다!

from js-deep-dive-study.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.