velopert / learnjs

벨로퍼트와 함께하는 모던 자바스크립트
https://learnjs.vlpt.us/
85 stars 47 forks source link

05. 함수 · GitBook #21

Open utterances-bot opened 4 years ago

utterances-bot commented 4 years ago

05. 함수 · GitBook

https://learnjs.vlpt.us/basics/05-function.html

saewookkangboy commented 4 years ago

// Hello, name! 관련한 예시 중에

function hello(name) { return 'Hello ${name}!' }

const result = hello('chunghyo') console.log(result)

이렇게 했을 때, codesandbox 에서는 Hello ${name}! 이렇게 console에 결과값이 노출되는데요. 위의 예시에 나와 있는 로그로 정리를 해도 동일한 결과 값이 나옵니다.

selena-jiyun-lee commented 4 years ago

' (Single quote) 대신에 ~와 같이 적혀진 `(Grave accent)를 사용하셔야 합니다!

sanghee-dev commented 4 years ago

console.log(add(1, 2));는 지저분해서 안쓰는 건가요?

hyerimhan commented 2 years ago

작은따옴표('')가 아닌 백틱(``)을 쓰셔야합니당

yongyonghw commented 2 years ago

본문에 templete literal 백틱 `` 이 명시되어있으면 좋겠어요

allsilver925 commented 2 years ago

22.02.24

KoreanCodingMachine commented 2 years ago

템플릿 리터럴 / 화살표 함수

Jibros commented 2 years ago

22.03.22

zuzubibi commented 2 years ago

22.03.22

ztc0320 commented 2 years ago

2022.04.08

codelua83 commented 2 years ago

22.05.24

LaurenSung commented 2 years ago

22.06.28

jdaria commented 2 years ago

22.07.06

JunghooX commented 2 years ago

22.08.14

neoseurae12 commented 2 years ago

22.08.19

neoseurae12 commented 2 years ago

나중에 알아볼 내용 : 화살표 함수와 일반 function 으로 만든 함수와의 주요 차이점은 화살표 함수에서 가르키는 this 와 function 에서 가르키는 this 가 서로 다르다는 것

jkf87 commented 1 year ago

템플릿리터럴이 예제 편집기 consolelog에서는 안먹는것 같습니다

jkf87 commented 1 year ago

아 백틱으로 해결했습니다

DANU011 commented 1 year ago

230306

DANU011 commented 1 year ago

화살표 함수 익명함수, 즉시 실행이 필요할 경우에 사용하기 적합함. 기존 함수 표현식과 비교했을 때 간단함. this의 값으로 lexical scope를 참조 시킬 때나 map 사용 시 this를 넘겨주어 코드를 더 쉽게 작성할 수 있다.

일반함수 this vs 화살표함수 this 일반함수 this

동적으로 바인딩되면서 자신이 종속된 객체를 this로 가리킴 화살표 함수this 상위 스코프의 this로 가리킴 (= Lexical this )

화살표 함수는 생성자 함수로 사용이 어렵고, arguments변수가 전달되지 않음. 객체 프로토타입으로 메소드를 선언할 때 화살표 함수는 적합하지 않음.

yoon052 commented 1 year ago

230525

choisooyoung-dev commented 1 year ago

23.06.26.

GitMume commented 11 months ago

23.09.01.

Habyeok commented 10 months ago

231021

kimsangbeom9703 commented 9 months ago

231115

daeunkim99 commented 2 months ago

240620